Skip to main content

Your package description here

Project description

jsonatago: JSONata for Python

jsonatago is a Python library that enables you to evaluate JSONata expressions. This project aims to bring the power and flexibility of JSONata to Python developers.

Credits

This project uses the Go implementation of JSONata from jsonata-go. All credit for the Go implementation goes to the authors and contributors of jsonata-go.

Installation

To install jsonatago, you can use pip:

pip install jsonatago

Usage

Here's a simple example that demonstrates how to evaluate a JSONata expression:

python

from jsonatago import Jsonata

JSONATA_TEST_DATA = {
    "Account": {
        "Order": [
            {"Product": [{"Price": 10, "Quantity": 2}, {"Price": 5, "Quantity": 5}]},
            {"Product": [{"Price": 20, "Quantity": 1}, {"Price": 15, "Quantity": 3}]}
        ]
    }
}
expr = Jsonata("$sum(Account.Order.Product.(Price * Quantity))")
print(expr.evaluate(JSONATA_TEST_DATA))

This will output the sum of all Price * Quantity for each product in each order.

You can use as well direct method for compilation and evaluation in one step. python

from jsonatago import jeval

JSONATA_TEST_DATA = {
    "Account": {
        "Order": [
            {"Product": [{"Price": 10, "Quantity": 2}, {"Price": 5, "Quantity": 5}]},
            {"Product": [{"Price": 20, "Quantity": 1}, {"Price": 15, "Quantity": 3}]}
        ]
    }
}
print(jeval(JSONATA_TEST_DATA,"$sum(Account.Order.Product.(Price * Quantity))"))

Contributing

If you'd like to contribute to this project, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

jsonatago-0.2.6.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distributions

jsonatago-0.2.6-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

jsonatago-0.2.6-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

jsonatago-0.2.6-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

jsonatago-0.2.6-cp312-cp312-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

jsonatago-0.2.6-cp312-cp312-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

jsonatago-0.2.6-cp312-cp312-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

jsonatago-0.2.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-cp312-cp312-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

jsonatago-0.2.6-cp311-cp311-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

jsonatago-0.2.6-cp311-cp311-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

jsonatago-0.2.6-cp311-cp311-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

jsonatago-0.2.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-cp311-cp311-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

jsonatago-0.2.6-cp310-cp310-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

jsonatago-0.2.6-cp310-cp310-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

jsonatago-0.2.6-cp310-cp310-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

jsonatago-0.2.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-cp310-cp310-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

jsonatago-0.2.6-cp39-cp39-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

jsonatago-0.2.6-cp39-cp39-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

jsonatago-0.2.6-cp39-cp39-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

jsonatago-0.2.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-cp39-cp39-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

jsonatago-0.2.6-cp38-cp38-win_amd64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

jsonatago-0.2.6-cp38-cp38-musllinux_1_1_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

jsonatago-0.2.6-cp38-cp38-musllinux_1_1_i686.whl (1.4 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

jsonatago-0.2.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

jsonatago-0.2.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (1.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

jsonatago-0.2.6-cp38-cp38-macosx_10_9_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

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