Skip to content

jsonata-core + jsonatapy

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

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 the same repository.


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
expr = jsonatapy.compile("orders[price > 100].product")
result = expr.evaluate({"orders": [{"product": "Laptop", "price": 1200}]})

# Pre-convert data for maximum throughput (3–15x faster for repeated queries)
data = jsonatapy.JsonataData(large_dataset)
result = expr.evaluate_with_data(data)

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}]}"#)?;
let result = Evaluator::new().evaluate(&ast, &data)?;

Command-line quick start

Both packages also ship a CLI, jq-shaped, with an identical contract:

pip install jsonatapy
echo '{"orders":[{"product":"Laptop","price":1200}]}' | jsonatapy 'orders[price > 100].product'
# "Laptop"

See CLI reference for the full flag/exit-code contract.


Performance highlights

  • 1682/1682 JSONata reference tests passing
  • ~6x faster on average than the JavaScript reference implementation — up to ~16x for pure expression workloads (strings, conditionals)
  • ~40x faster than jsonata-rs on pure-Rust Criterion benchmarks (no Python overhead)
  • hundreds of times faster than jsonata-python, even when it reuses its fastest (Context-based) repeated-evaluation path

See Performance for full benchmark results.


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 the official JSONata docs for the full language reference.