pub fn json_merge_patch(target: &Value, patch: &Value) -> ValueExpand description
Apply a JSON Merge Patch (RFC 7396) to a document.
§Arguments
target- The original JSON documentpatch- The merge patch to apply
§Returns
A new JSON document with the patch applied.
§Rules
- If
patchis not an object, it replacestargetentirely - If
patchis an object:- For each key in
patch:- If value is
null, remove the key fromtarget - If value is an object and target has an object at that key, merge recursively
- Otherwise, set the key to the patch value
- If value is
- For each key in