JSON Patch Playground
Work with RFC 6902 patches: apply one to a document, write one from two documents, or turn one around so it undoes itself.
Document
Colorazione sintattica disattivata.
The document is not read in this mode. Checking a patch looks only at the patch itself.
Patch
Colorazione sintattica disattivata.
Result
Colorazione sintattica disattivata.
The result appears here.
Affected paths
The paths a patch touches appear here.
Funziona interamente nel tuo browser.
Su questo strumento
A JSON Patch is a list of operations that turns one document into another. RFC 6902 defines it, and APIs that accept partial updates ask for it. This page does the four things that list is actually used for. Apply runs a patch against a document and prints the result. Generate compares two documents and writes the patch that turns the first into the second. Reverse runs a patch and writes the patch that undoes it, which needs the original document, because a remove says what to delete and not what was there. Check reads a patch on its own and reports whether it is well formed, which is the test worth running before sending one anywhere. All six operations are supported: add, remove, replace, move, copy and test. A patch is all or nothing, exactly as the specification requires: if one operation fails then none of them are applied, and the page says which one stopped and why. Values keep the text you wrote them with, so a twenty digit id survives a patch that never mentioned it and 1.0 stays 1.0. Comparison, which is what test asks and what generation uses to decide a value changed, reads 1 and 1.0 as the same number and ignores the order of object keys, while array order is data and is compared position by position.
Come usare
- Paste the document on the left and the patch on the right, or load the sample.
- Choose what to do: apply the patch, generate one from two documents, reverse one, or check a patch on its own.
- Read the affected paths, then copy or download the result.