Developer tools
JSON Merge Patch
Apply an object merge patch or replace a JSON target with a new value.
A clear answer. Here’s how.
Applies RFC 7396 recursively: object patches merge members, null member values delete keys, and non-object patches replace the whole target. Arrays are replaced as complete values rather than merged by index. An object patch starts from an empty object when the target is not an object. Reserved JavaScript property names are treated as ordinary JSON keys. Output remains bounded to 2 MB.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- JSON document
- {"name":"Ada","items":[{"id":9007199254740993,"active":true},{"id":2,"active":false}],"settings":{"theme":"blue"}}
- Merge Patch document
- {"settings":{"theme":"violet"},"name":null}
Example result
{
"items": [
{
"id": 9007199254740993,
"active": true
},
{
"id": 2,
"active": false
}
],
"settings": {
"theme": "violet"
}
}RFC 7396: object null members delete keys; non-object patches replace the whole target.