JSON diff and compare
Compare two JSON documents structurally — key order and formatting are ignored. Runs in your browser.
Runs 100% in your browserHow to compare two JSON files
- Paste both versions. Put the original JSON on the left and the new JSON on the right.
- Read the differences. Added, removed and changed values are listed by path.
Why a structural diff beats a line diff for JSON
Run two JSON documents through an ordinary line-by-line diff and the result is mostly noise: re-indentation, a reordered key, or a value that wrapped onto a new line all register as differences even though the data is unchanged. A structural diff sidesteps that by parsing both sides first and comparing the resulting trees value by value, keyed by path. The output is the set of changes that actually matter — added, removed and changed values — with the formatting noise filtered out.
Key order doesn't matter; array order does
This trips people up, so it's worth being explicit. Object keys are compared by name, not position, so
{"a":1,"b":2} and {"b":2,"a":1} are equal — reordering keys is
not a change. Arrays are different: order is part of an array's meaning in JSON, so items are compared by
index. That's why moving or inserting an array element can surface as several changes at once, which is the
honest answer rather than a guess about your intent.
When you'll reach for it
Reviewing an API response before and after a change, checking a config for drift between environments, or comparing two test snapshots — anywhere the question is "what actually changed in this data?" For free-form text or non-JSON files, the general diff checker does a line comparison instead, and the JSON formatter will validate either side if a paste won't parse.
Frequently asked questions
- A text diff compares lines. This compares JSON structurally: it parses both documents and reports added, removed and changed values by their key path, so reordered keys or reformatting don't create false differences.
- No. Objects are compared by key, not position, so
{"a":1,"b":2}and{"b":2,"a":1}are equal. Array order does matter, as it is significant in JSON. - A path present in both but with a different value is "changed"; a path only in the first is "removed"; only in the second is "added".
- By position. Array order is significant in JSON, so the items are compared index by index. A practical consequence: inserting one element at the front of a long array shows up as many "changed" entries, because every following item shifted by one. That's correct JSON semantics rather than a bug — structural diffing can't know you meant "inserted here".
- Each difference is reported by its path into the document — something like
user.roles[0].name— so in a large object you can jump straight to the value that moved instead of scanning the whole thing. - Yes — both documents are parsed and compared in your browser. Nothing is uploaded.