JSON Compare
Free JSON diff tool: compare two JSON documents ignoring key order, optionally array order, and see added, removed and changed values by path. Runs in your browser.
How to use JSON Compare
- 1Paste the original JSON into box A and the changed JSON into box B.
- 2Optionally tick Ignore array order, and filter the list by added, removed or changed.
- 3Read the differences with their paths, or copy the report as plain text.
What makes it better
- Structural diff: key order and whitespace never count as differences
- Optional array order ignoring for lists of IDs, tags or records
- Every change shown with its JSON path and the old and new value
- Counts of added, removed and changed values, and a clear Identical result
- Large inputs compared in a worker; long lists are paged with Show more
About JSON Compare
JSON Compare checks two JSON documents by structure rather than by text, so reordered keys and different indentation do not count as changes. Every difference is listed with its path, such as $.address.city, and the old and new value. You can also ignore the order of array items, and large documents are compared in a background worker.
Common uses
- See exactly which fields changed between two API responses after a deploy.
- Compare an exported configuration with a backup before restoring it.
- Verify that a migration or transform kept the data the same, apart from the intended changes.
- Review the difference between two versions of a JSON fixture used in tests.
Example
Input
{"name":"Ada","age":36,"role":"admin","tags":["math","code"],"address":{"city":"London"}}
=====
{"name":"Ada","age":37,"tags":["math","code","poet"],"address":{"city":"Paris"},"email":"[email protected]"}Result
~ $.age: 36 → 37 - $.role: "admin" + $.tags[2]: "poet" ~ $.address.city: "London" → "Paris" + $.email: "[email protected]"
Good to know
- Array items are matched by position by default. With Ignore array order, equal items are paired up regardless of position, and the rest are reported as added or removed.
- Numbers are compared by value, so 1 and 1.0 are equal, while integers beyond 2^53 are compared digit for digit.
- If a key repeats within one object, the last value is used. The list is limited to 20,000 differences, and the page says when it is cut off.
JSON Compare FAQ
How do I compare two JSON files?
Paste or open the first document in box A and the second in box B. The differences are listed immediately; if both documents are the same apart from formatting, the tool shows that they are identical.
Does key order matter when comparing JSON?
Not here. JSON objects are unordered by definition, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical. Only differences in keys, values or array contents are listed.
What does Ignore array order do?
It treats arrays as sets of items, so [1,2,3] equals [3,2,1]. Objects inside the arrays are compared as whole values, and anything that has no equal partner is listed as added or removed.
How are the paths written?
Paths start at $ for the root, use .name for keys, [0] for array positions and ["my key"] for keys with spaces or symbols. They are the same style the JSON Viewer copies, so you can find the value quickly.
Why is a changed array reported as several differences?
Without ignoring order, items are compared position by position, so inserting one item near the start shifts the rest and each shifted position shows as changed. Turn on Ignore array order if the order is not meaningful.