About the JSON Diff
This JSON diff tool compares two JSON documents by structure rather than by text. Paste the original on the left and the new version on the right, and it lists exactly which values were added, removed or changed — each with its path, such as $.order.items[2].price — together with the old and new values.
Because the comparison is semantic, differences that do not matter are ignored: key order, indentation, line breaks and number formatting like 1.0 versus 1. That makes it far more useful than a line-by-line text diff for checking API responses before and after a deploy, reviewing configuration changes, debugging snapshot tests, or confirming that a data migration did what you expected. Type changes, such as false becoming "no", are flagged separately because they often break clients.
The tool also produces an RFC 6902 JSON Patch that turns the first document into the second, with RFC 6901 JSON Pointer paths, ready to use with any JSON Patch library. Arrays are compared position by position. Everything runs in your browser, so private payloads never leave your machine.
How to use the json diff
- 1Paste the original JSON into box A.
- 2Paste the new or changed JSON into box B.
- 3Read the summary and the list of differences with their paths.
- 4Copy the JSON Patch if you need a machine-readable change set.
Formula and method
Both inputs are parsed with a standard JSON parser, so whitespace, indentation and number formatting disappear before comparison. The two trees are then walked together. For objects, keys present only in A are removed, keys present only in B are added, and shared keys are compared recursively — key order is irrelevant, as it is in the JSON data model (RFC 8259). For arrays, elements are compared position by position; extra elements at the end are reported as added or removed.
Any other mismatch — different numbers, strings, booleans, null, or values of different types — is a change. Paths are shown in JSONPath-style notation ($.a.b[0]); the JSON Patch uses RFC 6901 pointers (/a/b/0, with ~ and / escaped as ~0 and ~1), and array removals are emitted from the highest index down so the patch applies cleanly in order.
Worked examples
Product record before and after an update
The price changed from 10 to 12, a third tag "c" was appended, stock.store was deleted, and discontinued went from the boolean false to the string "no" — a type change. The new top-level key color is an addition. Five differences in total.
Same data, different formatting and key order
The keys appear in a different order, the indentation differs and 1.0 is written instead of 1, but JSON treats these as the same data, so there are zero differences and the patch is empty.
Array shortened, producing a JSON Patch
items[1] changes from 2 to 5, and items[3] and items[2] are removed — highest index first, so the indexes stay valid as the patch is applied. The key "a/b" contains a slash, which RFC 6901 escapes as ~1 in the pointer /a~1b.
Frequently asked questions
How do I compare two JSON files?+
Paste the first file into box A and the second into box B. The tool parses both and lists every value that was added, removed or changed, with its full path, so you do not have to scan two long documents line by line.
Does key order matter when comparing JSON?+
No. RFC 8259 defines a JSON object as an unordered collection of name/value pairs, so {"a":1,"b":2} and {"b":2,"a":1} are the same data. This tool ignores key order, whitespace and number formatting and reports only real data differences.
Does array order matter?+
Yes. JSON arrays are ordered, so [1,2] and [2,1] are different, and this tool compares arrays element by element by position. If an item is inserted at the start, every following element shows as changed — sort both arrays first if order is not meaningful in your data.
What is a JSON Patch?+
JSON Patch (RFC 6902) is a standard JSON format for describing changes as a list of operations such as add, remove and replace, each targeting a JSON Pointer path. Applying the generated patch to document A with any JSON Patch library produces document B.
Why does a text diff show more changes than this tool?+
Text diffs compare characters and lines, so re-indenting a file or reordering keys marks almost every line as changed. A structural JSON diff compares the parsed data, so only genuine value changes are reported.