JSON-Patch RFC 6902, JavaScript Object Notation (JSON) Patch implementation.
JSON-Patch implementation based on serde_json
crate.
Add this to your Cargo.toml:
toml
[dependencies]
json-patch = "*"
Create and patch document:
```rust
extern crate serdejson; extern crate jsonpatch;
use jsonpatch::patch; use serdejson::from_str;
let mut doc = json!([ { "name": "Andrew" }, { "name": "Maxim" } ]);
let p = from_str(r#"[ { "op": "test", "path": "/0/name", "value": "Andrew" }, { "op": "add", "path": "/0/happy", "value": true } ]"#).unwrap();
patch(&mut doc, &p).unwrap(); assert_eq!(doc, json!([ { "name": "Andrew", "happy": true }, { "name": "Maxim" } ]));
```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.