Skip to main content

A Python package that emits JSON Logic

Project description

jsonlogic.py - JSON Logic expression generator

This package provides functionality to express JSON Logic using standard Python datastructures.

An example:

>>> from jsonlogic import Variable
>>> v1 = Variable('var1')
>>> v2 = Variable('var2')
>>> e = (v1 < v2)
>>> print(e)
{"<": [{"var": "var1"}, {"var": "var2"}]}
>>> print (v1 < 3)
{"<": [{"var": "var1"}, 3]}
>>> print ( (v1 < 3) & (v1 > v2))
{"and": [{"<": [{"var": "var1"}, 3]}, {">": [{"var": "var1"}, {"var": "var2"}]}]}
>>> print ( (v1 < 3) & ~(v1 > v2)))  # ~ is "not"
{"and": [{"<": [{"var": "v1"}, 3]}, {"not": [{">": [{"var": "v1"}, {"var": "v2"}]}]}]}

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonlogic_py-0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

jsonlogic_py-0.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file jsonlogic_py-0.1.tar.gz.

File metadata

  • Download URL: jsonlogic_py-0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for jsonlogic_py-0.1.tar.gz
Algorithm Hash digest
SHA256 53819c125f2abdd8e2036c5375c355cfbc9c8f9af2263ece16dc850b562948fb
MD5 c04bb6c7b0e6d3e47a33f07933143da3
BLAKE2b-256 963d49b1e448a8a4bf6cec3ea6221626a16ab116574962ec0fe830e11d791ca1

See more details on using hashes here.

File details

Details for the file jsonlogic_py-0.1-py3-none-any.whl.

File metadata

  • Download URL: jsonlogic_py-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for jsonlogic_py-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fa76a84423010e27ab495150e66936da40be992c76ea52a161ca72bb0d98931
MD5 3c62d8c75752c32b5c1d78873fc15d1e
BLAKE2b-256 2a050850a799a09082233d4e584d1b482fb62a6d577f51c8917afbee38b0a301

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page