Why it matters
A line diff of two JSON files is noisy: reorder the keys or reformat the file and every line changes, and a moved array item shows as one deletion and one addition far apart. What you usually want to know is which values changed, at which paths.
This tool parses both documents and compares them as data. Objects are compared key by key in any order. Arrays of objects are matched by an identity key such as id, so a reordered list reads as moves and an edited item reads as a change, not a delete and re-add. Arrays without keys are aligned by content with the same algorithm as diff. The result is also written as an RFC 6902 JSON Patch and an RFC 7386 merge patch, and both are applied back to the first document in your browser to prove they produce the second, which catches the cases where a merge patch can't express the change.
How it works
- InputAn old and a new JSON document
- In your browserCompared as data, arrays matched by key
- OutputA change list, JSON Patch and merge patch, verified
Where it fits in a designer's workflow
- Plan
- Design
- Build
- Test
- Launch
By the numbers
Show the numbers as a table
| Change | Path |
|---|---|
| replace | /version |
| replace | /updated |
| add | /store/vat |
| remove | /products/2 |
| move | /products/0 |
| replace | /products/0/price |
| add | /products/0/tags/1 |
| add | /products/2 |
| add | /features/2 |
| add | /promo |
How to use it
- Paste the old document as A and the new one as B.
- Read the change list: each row is a JSON Pointer path with its old and new value.
- Set the array key if your items use something other than id, or switch to content-only matching.
- Copy or download the JSON Patch or merge patch; the checks say whether each one round-trips.
FAQ
What's the difference between JSON Patch and merge patch?
JSON Patch (RFC 6902) is a list of operations (add, remove, replace, move) at exact paths, so it can change single array items. Merge patch (RFC 7386) is a partial document merged over the original: simpler, but arrays are replaced whole and null always means delete.
Why does the merge patch fail the check?
A merge patch can't set a value to null, because null means remove the key. If the new document has nulls, use the JSON Patch.
Are 1 and 1.0 different?
Not here. JSON numbers are compared by value, as JSON.parse reads them. The tool notes when numbers are written in a non-standard form.
What about very large integers?
JavaScript can't hold integers beyond 2^53 exactly, so two different IDs like 12345678901234567890 and 12345678901234567891 could look equal. The tool warns when it sees them; store such IDs as strings.
Is my JSON uploaded?
No. Parsing, comparing and patching all happen in your browser.