Skip to main content

High-performance Python/Rust implementation of JSONata query and transformation language

Project description

jsonata-core + jsonatapy

High-performance JSONata implementation in Rust, with Python bindings.

Much of this project was built with human guidance using Claude Code. There was no performant JSONata implementation in Python, so the goal was to port JSONata to Rust (with a PyO3 wrapper for Python) and see how fast it could go. The answer: faster than V8 for most expression workloads, and ~40x faster than the next pure-Rust implementation.

Crates.io PyPI version Python versions License: MIT


Two packages, one implementation

jsonata-core jsonatapy
Language Rust Python
Published on crates.io PyPI
Install cargo add jsonata-core pip install jsonatapy
Use when You're writing Rust You're writing Python

jsonatapy is a thin PyO3 wrapper around jsonata-core. Both live in this repo.


Rust quick start

use jsonata_core::evaluator::Evaluator;
use jsonata_core::parser;
use jsonata_core::value::JValue;

let ast = parser::parse("orders[price > 100].product")?;
let data = JValue::from_json_str(r#"{"orders":[
    {"product":"Laptop","price":1200},
    {"product":"Mouse","price":25}
]}"#)?;

let result = Evaluator::new().evaluate(&ast, &data)?;
# Cargo.toml
[dependencies]
jsonata-core = "2.1.2"          # pure Rust, no Python dependency

# Optional: disable SIMD for constrained targets
jsonata-core = { version = "2.1.2", default-features = false }

Python quick start

pip install jsonatapy
import jsonatapy

# One-off evaluation
result = jsonatapy.evaluate('"Hello, " & name', {"name": "World"})
print(result)  # "Hello, World"

# Compile once, evaluate many times (10–1000x faster for repeated use)
expr = jsonatapy.compile("$sum(orders.(quantity * price))")
result = expr.evaluate({
    "orders": [
        {"product": "Laptop", "quantity": 2, "price": 1200},
        {"product": "Mouse",  "quantity": 5, "price": 25},
    ]
})
print(result)  # 2450

# Pre-convert data once for maximum throughput
data = jsonatapy.JsonataData(large_dataset)
result = expr.evaluate_with_data(data)   # 6–15x faster than evaluate(dict)

Supports Python 3.10, 3.11, 3.12, 3.13 on Linux, macOS (Intel & ARM), and Windows.


What is JSONata?

JSONata is a query and transformation language for JSON data:

  • Queryperson.name
  • Filterproducts[price > 50]
  • Transformitems.{"name": title, "cost": price}
  • Aggregate$sum(orders.total)
  • Conditionalsprice > 100 ? "expensive" : "affordable"

See official JSONata docs for the full language reference.


Performance

jsonata-core passes 1258/1258 JSONata reference tests and is the fastest JSONata implementation available in either Rust or Python.

Pure Rust (Criterion benchmarks, no Python overhead)

Category jsonata-core vs jsonata-rs
Simple path lookup 81 ns ~40x faster
Arithmetic expression 140 ns ~40x faster
Conditional 106 ns ~30x faster
String operations 126–284 ns ~30x faster
$sum (100 elements) 287 ns ~70x faster
Filter predicate (100 objects) 7.9 µs ~50x faster
Realistic workload (100 products) 9–44 µs ~40x faster

Run the benchmarks yourself:

cargo bench --no-default-features --features simd

Python path (jsonatapy)

jsonatapy is the fastest Python JSONata implementation by a large margin, and faster than the JavaScript reference implementation for most pure expression workloads:

Category vs JavaScript (V8) vs jsonata-python
Simple paths 2–14x faster ~20–40x faster
Conditionals 17x faster ~40x faster
String operations 4–9x faster ~30–45x faster
Complex transformations 3–17x faster ~20–40x faster
Higher-order functions ~1x (roughly equal) ~50–70x faster
Array-heavy workloads varies ~10–50x faster

The Python boundary

For large array workloads, the dominant cost is converting Python dicts to Rust values on each evaluate() call — not expression evaluation itself. Two API paths avoid this:

# Path 1: Pre-convert data once, reuse across many queries (6–15x faster)
data = jsonatapy.JsonataData(large_dataset)
result = expr.evaluate_with_data(data)

# Path 2: Data arrives as a raw JSON string — pass it directly
result_str = expr.evaluate_json(raw_json_string)

With pre-converted data, array-heavy workloads run within 2–7x of V8 — the irreducible gap between a Rust interpreter and V8's JIT compiler.

See Performance docs for full benchmark results and methodology.


Features

  • Full JSONata 2.1.0 compatibility — 1258/1258 reference tests passing
  • Pure Rust core — no JavaScript runtime, no Node.js dependency
  • Optional Python bindings — PyO3/maturin, zero-copy where possible
  • Cross-platform — Linux, macOS (Intel & ARM), Windows; Python 3.10–3.13
  • SIMD-accelerated JSON parsing — via simd-json (optional feature)

Documentation


Building from source

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Clone
git clone https://github.com/txjmb/jsonata-core.git
cd jsonata-core

# Build and install Python extension
pip install maturin
maturin develop --release

# Run Python tests
pytest tests/python/ -v

# Run Rust benchmarks (no Python required)
cargo bench --no-default-features --features simd

License

MIT — see LICENSE.

This project implements the JSONata specification. jsonata-js (the reference implementation) is also MIT licensed.

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

jsonatapy-2.1.3.tar.gz (166.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

jsonatapy-2.1.3-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

jsonatapy-2.1.3-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

jsonatapy-2.1.3-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

jsonatapy-2.1.3-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

File details

Details for the file jsonatapy-2.1.3.tar.gz.

File metadata

  • Download URL: jsonatapy-2.1.3.tar.gz
  • Upload date:
  • Size: 166.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonatapy-2.1.3.tar.gz
Algorithm Hash digest
SHA256 19b5bbdb55b58dead6d27c591eeb61e051444d64ff3a4d52be5080b74d87dc01
MD5 9af48bcb587b3de9e8288de7ef0f090c
BLAKE2b-256 1244fd2bdef52da02052caed1bd93161ed733a564c5f3c1759b875654369221e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3.tar.gz:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonatapy-2.1.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 befdbbbf101b9ab87d6d4cb1151876a92b7d656ecf642ba866926332e4abb0c5
MD5 adb705e25688dd73abe9546ebb81fca4
BLAKE2b-256 b7426566e5b31a78d9cab31b98b9773b6129e571f66589f7f033ef838a97e34e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp313-cp313-win_amd64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 513f752bedb47c596ebea03d8a9ccf52ce9b6b86feadeb9b8b5a38112db3f4fa
MD5 29e8bfa58af05b6d655edfdea9e3fc41
BLAKE2b-256 45d43c4f677cfd64877e38ddd8c9736beb584bbadb13253b699350400b32ae82

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 628c698e36b4c319cb9201ae9827c8b4fcd30fe34cc2f06de40921ca629e68c3
MD5 317cfac211cf9cc93e48f14f12c32dd3
BLAKE2b-256 4952a46bc284df9d5629d713f61921ef07e335d9df1103605204735cab833baa

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonatapy-2.1.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5fdb95044e9cb9609d45fc9a7f302d2cba1817e7a66f1ee600abfce1d151ae7e
MD5 53e9062dc24ba58bbf9901a7d84a7cdc
BLAKE2b-256 8b959752a034da87232153efb0ad374e861fb13de6a8c9dc75d0e1f639ff75b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp312-cp312-win_amd64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5dc6e225d2efd28bbf60e615c05c61f3cb08fa5504204473bb2b7df10f57403
MD5 705c6f8382471693d7f8ad92db94be9e
BLAKE2b-256 781118fe58d9d15dbd37a1d25b1f9fa810917b280cea8a101be3fcbb4302b71f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b3e914ecf8b9029f83b9f4c97784465cb5abd545e9def7542ffbd8826c334a40
MD5 138fc06773e6f8ee000eb32dd621ebf7
BLAKE2b-256 de9707d985e78b5d9bbe98184cfb877523252d0c2e3a40ce3a732b4b50ade7e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonatapy-2.1.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a6e92939c092faa4f6681f42e5dc25eb14bc962ae4c62ded494b9772e174eb97
MD5 9381e76b375b23c475b620431fa97f11
BLAKE2b-256 6f1ff9a976f59d29bdd67708e14ee4075dc4bd3c74ecfce123d691184ec91504

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp311-cp311-win_amd64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3dd7a5fa45c1e9009a589ff498450719fba298c6ae6f01e7839f6575f7967402
MD5 8c99392cb7c5cd77c77a3941812144b2
BLAKE2b-256 8d7b89fd5d7237479bbff2fd6e0a90aef3636afd24508e923608a53a8fe5d296

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 95514bf9c56ae50e8c32351f3a92717259cf2664639c840ff0086597cc4f90a6
MD5 0487b5185d3eff58eb66f9c7258e1a63
BLAKE2b-256 118aca7c1fe94a9fe6e1ebb143bfac1755d6ce1afcf7378b05ac5862fc7ed992

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonatapy-2.1.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c23d999f4a77115480a63b10b7cda143da58acdcebf04604d7ff0780afa32bbb
MD5 adba2db8b6712a7c21820b6b03ba2ca1
BLAKE2b-256 59f50f707925489cd43275ff417c0dbcd11f1f3a43d4472d9828fe94fa1be4f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp310-cp310-win_amd64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd06235eefceaae65c0ade2708d7d3de7fb00595778573fb91e9eaac52b8aa6f
MD5 5997a482e97e5f7da5b010b57b4b80eb
BLAKE2b-256 4513c879b5a14cbf54ae887fb4ec06e7c9c8dc647977984cb2fc1f927c4bbd34

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e4d55c271a6ec5efa0820bc5441d7fafb4516db512e0307fae85bd29b78eebf
MD5 20019c99d61d6fd7a3e9aa79729379fe
BLAKE2b-256 848b8e707706cbdad7caad873840ed7e72cca5d0baa3132c7eac6a04f1d9daad

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on txjmb/jsonata-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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