jsonata-core + jsonatapy
High-performance JSONata implementation in Rust, with Python bindings.
Much of this project was built using Claude Code with significant human oversight. 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. The rust versions are published on crates.io, and the python wheels on pypi.
Many, many thanks to the incredible work of all the maintainers of the JSONata reference library. JSONata is a very powerful, well-designed, and useful language that has made an impact on many projects. This project leverages their outstanding work to extend that capability to Python and Rust and would not be possible without that project. The implementation in Rust was strongly influenced by their implementation. The 1600+ tests they created provided the scaffolding and validation for all of this project. This project will continue to follow and be a derivative of the reference project as the JSONata reference library evolves.
Release versions will follow the reference jsonata-js project major and minor release numbers, but not necessarily patches. This will make it easier for adopters of this library to understand each release's JSONata API compatibility. As an example, 2.1.7 should be compliant with 2.1.x jsonata-js tests, but may have fixes specific to this library. If a patch release for jsonata-js is relevant for this project, it will be included in a patch release that may or may not follow the patch numbers of the upstream project.
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.6" # pure Rust, no Python dependency
# Optional: disable SIMD for constrained targets
= { = "2.1.6", = 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
=
= # 3–15x faster than evaluate(dict)
Supports Python 3.10, 3.11, 3.12, 3.13, 3.14 on Linux, macOS (Intel & ARM), and Windows.
Command-line quick start
Both packages also ship a CLI, jq-shaped, with an identical contract:
|
# "Laptop"
See CLI Reference for the full flag/exit-code contract.
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:
- ~6x faster on average than the JavaScript reference implementation (V8), across all benchmark categories — up to ~16x for complex transformations and string operations
- ~40x faster than jsonata-rs (the next pure-Rust JSONata implementation) on pure-Rust
Criterion benchmarks with no Python overhead on either side (
cargo bench) - hundreds of times faster than jsonata-python, even when it reuses its fastest
(
Context-based) repeated-evaluation path
For large array workloads, pre-convert data once with jsonatapy.JsonataData and reuse it
across queries — this avoids the Python↔Rust conversion cost that otherwise dominates:
=
= # 3–15x faster than evaluate(dict)
See Performance docs for the full category-by-category breakdown and benchmark 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.14
- SIMD-accelerated JSON parsing — via
simd-json, enabled by default (disable with--no-default-features)
Documentation
- Installation
- API Reference
- Usage Guide
- CLI Reference
- Performance
- Optimization Tips
- Building from Source
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.