JSON Diff & Patch Tool
Compare two JSON documents and generate RFC 6902 add, remove and replace operations. Review and copy the patch locally.
About this json diff & patch tool
Compare two JSON documents and generate RFC 6902 add, remove and replace operations. Review and copy the patch locally Transforms and validates developer data structures locally, preventing confidential payload exposure during data wrangling.
Syntax parsing & data transformation logic
Compares two JSON documents and generates RFC 6902 add, remove and replace operations. Object keys use RFC 6901 escaping: ~ becomes ~0 and / becomes ~1. An empty path addresses the whole document. Changed arrays are replaced as a whole; structurally equal arrays produce no change.
Worked conversion & output example
Scenario: Enter 1 in the first input and 2 in the second input.
Sample input:
Second field:
Processing:
Illustrative output:
Syntax constraints & input size limits
Each document is limited to 1,000,000 UTF-16 code units and 100 nesting levels; output is limited to 8,388,608 code units. Duplicate keys, unsafe integers, overflow, underflow and decimal values that cannot retain their value on serialization are rejected. Quote exact large or high-precision values as strings. Formatting whitespace outside strings and object key order are not differences; whitespace inside strings remains significant. This generates a patch but does not apply one, generate JSON Merge Patch or guarantee the smallest patch. No file input or download is offered. Text must contain valid Unicode; unpaired UTF-16 surrogates are rejected.
Data conversions and formatting in JSON Diff & Patch Tool reflect standard structured syntax. Verify parsed outputs against your target runtime before deployment.
Local client execution boundary
Data parsing and transformations in JSON Diff & Patch Tool execute in the local browser tab without remote data transmission.
Data format specifications & language standards
Data interchange formats and language grammar specifications:
- RFC 6902: JSON Patch add/remove/replace generation
- RFC 6901: JSON Pointer
- RFC 8259: JSON, with documented numeric and duplicate-key restrictions
JSON Diff & Patch Tool verification · Audit standards
How to use it
- Enter, paste, or select your input data into the JSON Diff & Patch Tool workspace controls.
- Choose Run locally to generate the patch.
- Check that the replace operation has an empty path, then copy the output.
Frequently asked questions
How do I compare two documents with JSON Diff?+
Enter the first JSON in Input and the comparison JSON in Second input / expression, then press Run locally. For {"a":1} versus {"a":2,"b":true}, the output contains replace for /a and add for /b.
What patch format and path escaping does the output use?+
It emits add, remove, and replace objects in a JSON Patch array. Object-key paths escape ~ as ~0 and / as ~1; an empty path represents replacing the document root.
How are arrays and object-key ordering compared?+
Object member order and formatting whitespace outside strings do not create a difference. A changed array is replaced as a whole, so this generator does not promise the smallest possible edit sequence.
Can JSON Diff apply its patch or accept unsafe JSON numbers?+
It generates a patch only; it does not apply it or create Merge Patch. Duplicate keys, unsafe integers, lossy decimals, invalid Unicode, excessive nesting, and documents over the stated limits are rejected before comparison.
