Apply an RFC 6902 JSON Patch to a document — all six operations (add, remove, replace, move, copy, test), executed in order with test-failure abort, exactly per the spec.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Spec-exact patch execution
Paste a document and an RFC 6902 patch array, and the operations run in order against a copy of the document: add, remove, replace, move, copy — and test, which asserts a value and aborts the whole patch when the assertion fails, exactly as the RFC requires. Every failure names the operation index, the pointer and the reason, so a broken patch tells you where it broke.
Worked example
Document {"title":"Draft","tags":["tech"]} plus:
[
{ "op": "replace", "path": "/title", "value": "Final" },
{ "op": "add", "path": "/tags/-", "value": "featured" }
]yields:
{ "title": "Final", "tags": ["tech", "featured"] }When to use it
- Previewing what a PATCH request will do to a record before sending it.
- Debugging a 422 from a PATCH endpoint — apply the same patch here and see which operation fails and why.
- Round-trip testing patches from the JSON Patch Generator.
Limitations to know
- Operations are strict per the RFC: replace requires the target to exist, array add indexes must be within range (or “-” to append), and move cannot target its own child.
- The patch must be a JSON array — a single operation still needs its brackets.
Common errors and fixes
- “test failed … patch aborted” — the document does not match the state the patch expects; that is the operation doing its job as optimistic locking.
- “array index out of range” — indexes shift as earlier operations run; order the operations accordingly or use “-” to append.
How to use the JSON Patch Applier
- Paste the document into the first panel and the RFC 6902 patch array into the second.
- Click "Apply patch".
- Operations run in order; the patched document appears in the output.
- If a "test" operation fails, the whole patch aborts with the exact reason — per the RFC.
Frequently asked questions
Which patch operations are supported?
All six from RFC 6902: add, remove, replace, move, copy and test — with correct semantics, including "-" for array append, replace requiring an existing target, and move refusing to move a value into its own child.
What does the "test" operation do?
It asserts that a value equals what you expect before the edits proceed — optimistic locking inside the patch. If the test fails, nothing is applied and the error tells you the actual value found.
Why did my "add" to an array index fail?
Array add inserts at the index, which must be between 0 and the array length (or "-" to append). Beyond-length indexes are invalid per the RFC — the error names the valid range.
Is the original document modified?
Never — patches apply to a deep copy, and your input stays in the panel. Apply, inspect, adjust the patch, re-apply: iterating is free.