Expand description
Native RFC 9535 JSONPath queries over yaml-rt semantic documents.
Queries are parsed once and can be evaluated repeatedly without converting YAML into an intermediate JSON value tree.
use yaml_rt_core::YamlDoc;
use yaml_rt_rfc9535::JsonPath;
let doc = YamlDoc::parse("users: [{name: Ada}, {name: Linus}]\n")?;
let path = JsonPath::parse("$.users[*].name")?;
let matches = path.query(&doc, 0)?;
let pointers = matches
.iter()
.map(|matched| matched.pointer().as_str())
.collect::<Vec<_>>();
assert_eq!(pointers, ["/users/0/name", "/users/1/name"]);Structs§
- Error
- A structured
JSONPathparse or evaluation error. - Json
Path - A parsed and reusable RFC 9535
JSONPathquery. - Query
Match - One located
JSONPathmatch. - Query
Matches - Ordered
JSONPathquery results.
Enums§
- Error
Kind - Classification of a
JSONPathparse or evaluation failure.