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 faster than the next pure-Rust implementation.
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 Evaluator;
use parser;
use JValue;
let ast = parse?;
let data = from_json_str?;
let result = new.evaluate?;
# Cargo.toml
[]
= "2.1.2" # pure Rust, no Python dependency
# Optional: disable SIMD for constrained targets
= { = "2.1.2", = false }
Python quick start
# One-off evaluation
=
# "Hello, World"
# Compile once, evaluate many times (10–1000x faster for repeated use)
=
=
# 2450
# Pre-convert data once for maximum throughput
=
= # 4–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:
- Query —
person.name - Filter —
products[price > 50] - Transform —
items.{"name": title, "cost": price} - Aggregate —
$sum(orders.total) - Conditionals —
price > 100 ? "expensive" : "affordable"
See official JSONata docs for the full language reference.
Performance
jsonata-core passes 1682/1682 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:
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 | 5–8x faster (array index access: roughly tied) | ~20–40x faster |
| Conditionals | 15x faster | ~40x faster |
| String operations | 8–15x faster | ~30–45x faster |
| Complex transformations | 5–15x faster | ~20–40x faster |
| Higher-order functions | 12–19x faster | ~50–70x faster |
| Array-heavy workloads | ~1–3x slower to ~4x faster, depending on access pattern | ~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 (4–15x faster than evaluate(dict))
=
=
# Path 2: Data arrives as a raw JSON string — pass it directly
=
With pre-converted data, realistic workloads (filtering, transforming, aggregating over
100-object arrays) run ~5–8x faster than V8, not slower — even the raw evaluate(dict)
path without pre-conversion is roughly at parity with V8 (0.5–2x either direction).
See Performance docs for full benchmark results and methodology.
Features
- 1682/1682 JSONata 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
|
# Clone
# Build and install Python extension
# Run Python tests
# Run Rust benchmarks (no Python required)
License
MIT — see LICENSE.
This project implements the JSONata specification. jsonata-js (the reference implementation) is also MIT licensed.