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.4.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.4-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

jsonatapy-2.1.4-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.4-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.4-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

jsonatapy-2.1.4-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.4-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.4-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

jsonatapy-2.1.4-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.4-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.4-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

jsonatapy-2.1.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: jsonatapy-2.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 2cb16c710b631ac3a0d55505f01401cf8e12171554c1c48860a1685a69c860c8
MD5 1d2a661e20850ed1e9809e49c7e7350e
BLAKE2b-256 eeb940f731ed8ccf859e253db84ea438ec1a7ba8ffa99fb5a773292df214df61

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4.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.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8bf1277d160020e16863b4bfd0d76b967a797b33dcc5990a1847c4efac1cb25c
MD5 6933877cba549cdaee54c3c65ca488bb
BLAKE2b-256 f1c0aaf5617f3159f4e696073007da834e0b7f4add8c87c9377bdc398694b531

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e06d2a1e78a87f031568f8a07adb136e2bb489be4c252da2841be5aa2aa1c92d
MD5 8127a9ee15cc65c678c8bcf6f83b52c0
BLAKE2b-256 472d5e855949e880197bbafaf6fb67331b97d89a78cb6222cd4fb54bd4f895b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 57bf9b062b1bb9f9041cfb33a673e7c1d740f223d24b30ce33c496a7916f28c9
MD5 5b56eb55149347bc905eee09f33fd888
BLAKE2b-256 d9e1b5051166e2ec929e28e17d8fcc7f4aeca8475fbcf3907201be13ce7b2738

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 066865c27481b2ab9df7f1805cc80350e8f39f7faed03027c42d22deee75aed1
MD5 17cccc6815d357138a54892bf0e39a4a
BLAKE2b-256 6f42f13d225afe62f05cb2ba8887605e5ca7ceb74513122814951391995845ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff8065c9658317fa140ea681826f89e9be60d11d3364d6aa3644db311f65efb4
MD5 42af22bc2bfa963086fd3399a0e83f14
BLAKE2b-256 87aed4fed2e475b4ab931be6eaa32e465fb538d88613619d9ed49529cd2e19fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dbbde9ba01c60c2b5a438671f5619d3e3b6213197a3eaf552f00329a054c09fb
MD5 b928f25984950176d56c8c722c6e2fc2
BLAKE2b-256 878b24e6476a8571df5592d7d944c155161b7ac9736648a38790c1b4e3cdd795

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6fd1cd74dda36e2e7f0be4f2cfc0affa7aa698b840f28d1562ea32a28402c068
MD5 14d54d8845f3fd4b8b13e9efba0a992a
BLAKE2b-256 2c03705fa27c4bf7d1457bced61f3c66c6ebf645c339d20498af6d7ef12f5ede

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d019ab065f3bc8f37efef0ddac7adfc59c2ba8541a8eb85252febed1c5501a8e
MD5 49c9cc62a30363fc53e953a49a6b6607
BLAKE2b-256 f75637c9633c00af0284ee57592ab371fa58faa47290cf35108a3678e41bd232

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 98b05565e2b6873c02082353dbd140519969b36d5a25db9ed860ed03b4fe85ad
MD5 5bd117ae6a3f585ad28278817c41c3c7
BLAKE2b-256 ccf01500b291c3d722e216dac6c958a119c355dd8861b8a8f2c9b8ede1e35420

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: jsonatapy-2.1.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fa15fef9c660d401416aec5f1ea63a99a8c71958a3cfd9543fa32dd3f43a6cee
MD5 179088a85bab876fb9031c8c786e8230
BLAKE2b-256 f7fba28b9a8c7b594cf626a2a92b5a6321d46bfb26865e43938fbdeb8461926d

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab4fb3af9c461d379fca4fc9cee16fe76da26cb985457e648ffa8c3696cc64bf
MD5 62b1e319f43201cd76677fed31e68359
BLAKE2b-256 b587e6852cc1ff1a92a54b3222b9d1554c171af0c5a1d1acddb1a98f19f55417

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jsonatapy-2.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 489afe34ddba2b671d87c5a5163d7584e818d0e981abaf7dbf2515ddaf8ab862
MD5 6199af78d06800424204450265bf1e7b
BLAKE2b-256 62a87b0864adcb1856381a1add2a4109b6f892571c82628b82de3cde1869cc22

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonatapy-2.1.4-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