Skip to main content

Crate jetro

Crate jetro 

Source
Expand description

Jetro — transform, query, and compare JSON.

use jetro::Jetro;
use serde_json::json;

let j = Jetro::new(json!({
    "store": {
        "books": [
            {"title": "Dune",        "price": 12.99},
            {"title": "Foundation",  "price":  9.99}
        ]
    }
}));

let count = j.collect("$.store.books.len()").unwrap();
assert_eq!(count, json!(2));

Modules§

ast
Abstract syntax tree for Jetro v2 expressions.
eval
Tree-walking evaluator — reference semantics for Jetro v2.
parser
PEG parser for Jetro v2 source text.
prelude
Convenience re-exports.
vm
High-performance bytecode VM for v2 Jetro expressions.

Structs§

Compiler
Engine
Shared, thread-safe query engine.
EvalError
Expr
A parse-checked Jetro expression with a phantom output type.
Graph
A collection of named JSON documents that can be queried together via the v2 VM.
Jetro
Primary entry point for evaluating Jetro expressions.
MethodRegistry
ParseError
Program
A compiled, immutable v2 program. Cheap to clone (Arc internals).
VM

Enums§

Error
Engine-side error type. Either a parse failure or an evaluation failure.

Traits§

JetroSchema
Trait implemented by #[derive(JetroSchema)] — pairs a type with a fixed set of named expressions.
Method
A custom method that can be registered with MethodRegistry.

Functions§

query
Evaluate a Jetro expression against a JSON value.
query_with
Evaluate a Jetro expression with a custom method registry.

Type Aliases§

Result