Rust implementation of JMESPath, a query language for JSON.
This crate is on crates.io and can be used
by adding jmespath
to the dependencies in your project's Cargo.toml
.
toml
[dependencies]
jmespath = "0.0.1"
```rust extern crate jmespath;
let expr = jmespath::Expression::new("foo.bar | baz").unwrap();
// Parse some JSON data into a JMESPath variable let jsonstr = "{\"foo\":{\"bar\":{\"baz\":true}}}"; let data = jmespath::Variable::fromjson(json_str).unwrap();
// Search the data with the compiled expression let result = expr.search(data).unwrap(); asserteq!(true, result.asboolean().unwrap()); ```