Expand description
A crate to provide a fast, correct and safe implementation of JSON Patch (RFC 6902)
It can apply patches to JSON documents:
let doc = json!({"hello": "world"});
let patch = Patch::Add {
path: Path::new("/foo"),
value: json!("bar"),
};
assert_eq!(
apply(doc, vec![patch]).unwrap(),
json!({
"hello": "world",
"foo": "bar",
})
);
It can also calculate the diffs between 2 JSONs:
let patches = diff(
json!({"hello": "world"}),
json!({"hello": "world", "foo": "bar"}),
);
assert_eq!(
patches[0],
Patch::Add {
path: Path::new("/foo"),
value: json!("bar"),
}
);
Structs§
Enums§
Functions§
- apply
- Applies a collection of JSON Patches to a JSON document The patches are applied in order, and if any individual patch fails, the whole function fails
- apply_
single - Applies a single JSON Patch to a JSON document
- diff
- Compute the diff between two JSON Documents