Skip to main content

zopyx.pyjsonata

Python bindings for the Rust implementation of JSONata, powered by PyO3 and maturin. This package exposes the JSONata evaluator from jsonata-rs to Python with a small, focused API.

Quick start

Install from source (local)

UV_CACHE_DIR=/tmp/uv-cache uv venv .venv --python 3.13 --clear
UV_CACHE_DIR=/tmp/uv-cache uv pip install --python .venv/bin/python "maturin[zig]"
UV_CACHE_DIR=/tmp/uv-cache .venv/bin/python -m maturin develop --features python

Use

from zopyx.pyjsonata import evaluate, UNDEFINED, Jsonata

# Evaluate a simple expression
print(evaluate("1 + 1"))

# Evaluate with input data
print(evaluate('"Hello, " & name & "!"', {"name": "world"}))

# Provide variable bindings
bindings = {"x": 2, "y": 3}
print(evaluate("$x + $y", UNDEFINED, bindings))

# Reuse a compiled expression
expr = Jsonata("$sum([1,2,3])")
print(expr.evaluate())

API

evaluate(expr, input=UNDEFINED, bindings=None, max_depth=None, time_limit=None)

  • expr: JSONata expression string
  • input: JSON data for $ (default UNDEFINED = no input)
  • bindings: dict of variable bindings, e.g. {"x": 1}
  • max_depth: optional evaluator depth limit
  • time_limit: optional evaluation time limit

Returns standard Python types: dict, list, str, float, int, bool, None, or UNDEFINED.

Jsonata(expr)

Constructs a reusable expression object.

  • Jsonata.evaluate(...) has the same signature as evaluate but with the expression pre-parsed.

UNDEFINED

Represents missing input (distinct from JSON null). In Python, None maps to JSON null.

Errors

Errors raise ValueError and include the JSONata error code prefix (e.g. T0410), matching the Rust implementation.

Build wheels (manylinux)

UV_CACHE_DIR=/tmp/uv-cache .venv/bin/python -m maturin build \
  --release \
  --features python \
  --compatibility manylinux_2_28 \
  --interpreter python3.11 python3.12 python3.13 \
  --zig \
  --auditwheel=repair

Tests

  • Rust tests: cargo test
  • Python testsuite port: make test-python or just test-python

Limitations

This is an incomplete JSONata implementation. Many reference tests are skipped under tests/**/skip.

License

Apache-2.0.

Maintainer

Andreas Jung — info@zopyx.com

Release files for zopyx.pyjsonata 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for zopyx.pyjsonata 0.3.7
File Interpreter ABI Platform
zopyx_pyjsonata-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
zopyx_pyjsonata-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
zopyx_pyjsonata-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details

Total release size: 2.4 MB

Release files / zopyx_pyjsonata-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL zopyx_pyjsonata-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl
Size 797.5 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e8d03c2d28c7f5744d34f0d4a4fa74ca92263591f6015d73726b601816e125dd
BLAKE2b-256 checksum
How to use checksums
17b330142b85992fe9be0c43001ea96bbbddafd21c943c142f7ea949b575371e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / zopyx_pyjsonata-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL zopyx_pyjsonata-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl
Size 797.9 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8e20344e39038db682fa0f5683ace336c69993498e7fc5c65860f1f28b06ba52
BLAKE2b-256 checksum
How to use checksums
0e51c5b72b92d46829edcc705144c607d5e5daf60d5630c59d68d19f69a81d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / zopyx_pyjsonata-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL zopyx_pyjsonata-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl
Size 799.1 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7cf165909f9721851b22ff2acccc6d7d33a3abd612fb76119376c8f9394f674a
BLAKE2b-256 checksum
How to use checksums
d82d45a5f96ce9afccb1e8f5e79fb9e04f71d066d5f6b9f5b76400b1fcc63eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.3.7 This release

3 release files

0.3.6

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page