JSON Patch Apply
Apply a JSON Patch (RFC 6902) to a JSON document and get the patched result. Paste the document and the patch array, and every operation, from add and remove to move, copy and test, is validated and applied in order. If an operation fails, the tool names the operation and the reason.
Frequently asked questions
Which operations are supported?
All six operations of RFC 6902: add, remove, replace, move, copy and test. Paths and from values are JSON Pointers as defined in RFC 6901, and - at the end of an array path appends an item.
What happens if one operation fails?
A patch is applied all or nothing. If any operation fails, for example because a path does not exist or a test does not match, no result is returned and the message names the number of the failing operation.
Can I paste a single operation?
Yes. A single operation object is treated as a patch with one operation. Otherwise the patch must be a JSON array of operations.
Why does a test operation fail?
A test operation compares the value at its path with its value and fails if they differ. Numbers, strings, arrays and objects must be equal in content, and object key order does not matter.
Why is my __proto__ path rejected?
Paths that would modify __proto__, constructor or prototype are refused, because such patches are a known way to attack JavaScript programs. Ordinary keys are not affected.
Is my original document changed?
No. The patch is applied to a copy, and the result is shown as formatted JSON.