json-pointer
A crate for parsing and using JSON pointers, as specified in RFC 6901.
Creating a JSON Pointer
JSON pointers can be created with a literal [&str]
, or parsed from a String
.
let from_strs = new;
let parsed = "/foo/bar"..unwrap;
assert_eq!;
Using a JSON Pointer
The JsonPointer
type provides .get()
and .get_mut()
, to get references
and mutable references to the appropriate value, respectively.
// where ptr is either of the JsonPointers from above.
let document = json!;
let indexed = ptr.get.unwrap;
assert_eq!;