JSON Patch applier
Apply a checked sequence of add, remove, replace, move, copy and test operations.
A clear answer. Here’s how.
Applies up to 200 RFC 6902 operations to a copy of the input. Uses strict JSON Pointers, ordered array insertion and structural test equality; numerically equivalent decimal tokens compare equal exactly. Failed operations produce no partial output. Moving a node into its descendant is rejected. Removing the entire root is unsupported because it would leave no JSON value; replace root with null instead. Each intermediate/result document must remain within 2 MB and 64 levels.
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"}}
- JSON Patch operation array
- [{"op":"test","path":"/name","value":"Ada"},{"op":"add","path":"/items/-","value":{"id":3,"active":true}}]
Example result
{
"name": "Ada",
"items": [
{
"id": 9007199254740993,
"active": true
},
{
"id": 2,
"active": false
},
{
"id": 3,
"active": true
}
],
"settings": {
"theme": "blue"
}
}All operations were applied to a copy; failed operations return no partial result.