Developer · Diff
JSON diff and compare.
Paste two JSON documents. Key order and whitespace are ignored; every added, removed and changed value is listed by its JSON Pointer path, with an optional RFC 6902 JSON Patch that turns the first into the second. Arrays are compared by index. Runs in your browser; nothing is uploaded.
Inputs
Differences
Paste both documents and press Compare.
Worked example
Original:
{"name":"api","port":80,"tags":["a","b","c"],"a/b":{"x~y":1},"gone":true}
Modified (keys reordered, other edits made):
{"tags":["a","z"],"name":"api","port":8080,"a/b":{"x~y":2},"new":null}
Differences, by JSON Pointer path:
changed /port 80 -> 8080 changed /tags/1 "b" -> "z" removed /tags/2 "c" changed /a~1b/x~0y 1 -> 2 removed /gone true added /new null
RFC 6902 patch that turns the original into the modified document:
[{"op":"replace","path":"/port","value":8080},
{"op":"replace","path":"/tags/1","value":"z"},
{"op":"remove","path":"/tags/2"},
{"op":"replace","path":"/a~1b/x~0y","value":2},
{"op":"remove","path":"/gone"},
{"op":"add","path":"/new","value":null}]
Moving name to a different position is not a difference, because an object is an unordered set of members. The key a/b is written a~1b and x~y is written x~0y in a pointer, as RFC 6901 requires.
How the comparison works
Objects are matched by key. A key only in the original is removed, a key only in the modified document is added, and a key in both is compared recursively. Key order never matters (RFC 8259, section 4: an object is an unordered collection).
Arrays are compared by index. Element 0 is compared with element 0, element 1 with element 1, and so on; extra elements at the end are added or removed. The tool does not try to detect that an item moved or was inserted at the front, so inserting one item at the start of a 100-item array reports every later index as changed. This matches how RFC 6902 addresses array positions, and it keeps the result predictable.
Values of different types (for example "1" against 1, or null against {}) are one changed entry at that path. Numbers are read as IEEE 754 doubles, so 1 and 1.0 are equal, and two integers above 9007199254740991 that differ only in their last digits can read as equal (RFC 8259, section 6). Whitespace between tokens is ignored. If an object repeats a key, the last one wins, as in JSON.parse.
The patch uses only add, remove and replace (RFC 6902, sections 4.1 to 4.3). Array removals are written from the highest index down so earlier indexes do not shift. The tool applies the patch to the original itself and tells you whether the result equals the modified document; if that check ever fails it says so instead of showing a patch silently.
Sources (as of 2026-10-01): RFC 8259, The JSON Data Interchange Format; RFC 6902, JSON Patch; RFC 6901, JSON Pointer.
Frequently asked questions
Does key order matter when comparing JSON?
No. A JSON object is an unordered collection of members, so two objects with the same keys and values in a different order are equal. Order does matter inside arrays.
Why does inserting one array item flag everything after it?
Because arrays are compared by index. Item 3 in the original is compared with item 3 in the modified document, so after an insertion every later pair differs. Compare after sorting, or use the Code Diff Checker for a line-based view that tolerates insertions.
What is a JSON Pointer path like /a~1b/0?
It is the address of a value (RFC 6901). Each / goes one level down, a number picks an array index, and ~1 stands for a literal / while ~0 stands for a literal ~ inside a key. An empty path means the whole document.
Can I apply the JSON Patch with other software?
Yes. It uses only add, remove and replace, which every RFC 6902 implementation supports. Operations run in order, so keep the order shown.
Is my JSON uploaded?
No. Parsing and comparing happen in your browser and nothing is stored or sent.
Data comparison only
This tool compares structure and values. It does not know what your fields mean, so a change it lists may be harmless or important to your application. Very large inputs may be slow on a phone.