Skip to main content

An expression language.

Project description

jsonexpr for Python

This document describes using jsonexpr with Python. For the language overview, see the main page.

Installation

pip3 install jsonexpr

Python 3.8 and later are supported.

Example

import jsonexpr as je

instance = je.instance()
parsed = instance.parse("""
    PRINT("I have " + LEN(grades) + " students");
    PRINT("Alice's grade is " + grades.alice);
    grades
""")
symmap = instance.symmap({
    "grades" : {
        "alice"   : "A",
        "bob"     : "B",
        "charlie" : "B",
    }
})

result = parsed.eval(symmap)

Output:

I have 2 students
Alice's grade is A

License

Apache 2.0

Project details


Download files

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

Source Distribution

jsonexpr-0.2.0.tar.gz (80.1 kB view details)

Uploaded Source

File details

Details for the file jsonexpr-0.2.0.tar.gz.

File metadata

  • Download URL: jsonexpr-0.2.0.tar.gz
  • Upload date:
  • Size: 80.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for jsonexpr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 133763aae92d6ef935edc67f7448e328b38abfd0166c2ff9f2e6a536ab9f2931
MD5 539f36d2db21eb22b8da7e2796aac002
BLAKE2b-256 88be2c906412e7f21a83e431ab7b920658d8e4ff199b05e16ca7a81719a13ae5

See more details on using hashes here.

Supported by

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