json-patch
json-patch copied to clipboard
`diff()` produces invalid patches for root replacements
The following will fail with an invalid pointer error:
let mut a = serde_json::Value::from(0);
let b = serde_json::Value::from(1);
let patch = json_patch::diff(&a, &b);
json_patch::patch(&mut a, &patch).unwrap();
The problem is that diff() generates a replacement with / as the path, which then can't be applied.