JSON Diff
Compare two JSON documents by structure instead of text. Every added, removed and changed leaf is listed with its exact path, so key order and indentation never matter.
Paste two JSON documents and this tool compares them by shape and value rather than character by character. If the two documents hold the same data but the keys were written in a different order, or one is pretty-printed and the other is minified, the result is still "structurally identical". When they genuinely differ, you get a list of every single leaf that changed, each labelled ADDED, REMOVED or CHANGED and pinned to a path such as x.y[1].
What is a JSON diff?
A JSON diff is a comparison of two JSON documents at the level of their parsed structure — objects, arrays and the primitive values at the leaves — rather than at the level of the raw text. A plain text diff flags a reordered key or a switch from two-space to four-space indentation as a difference, even though nothing about the data changed. A structural diff ignores that formatting noise and reports only the values that were actually added, removed or altered, together with the path where each change sits.
How the JSON diff works
Both sides are parsed with JSON.parse and then walked depth-first in parallel, so the comparison happens on the data model rather than the text. RFC 8259 defines an object as an unordered collection, which is exactly why reordered keys and different indentation are reported as identical here — a line-based diff would flag them as changes. Object keys present on one side only become ADDED or REMOVED; arrays are matched by index, so an insertion near the front shifts every later element and shows up as a run of changes rather than one move. Leaves are compared by type and value, which makes 30 versus "30" a real difference. Paths are printed in the dotted, bracketed form (user.tags[1]) that mirrors the JSON Pointer idea of addressing one node inside a document.
Features
How to use this JSON Diff tool
Paste your first JSON document — a config file, an API response, a fixture — into the left field.
Paste the version you want to compare it against into the right field.
Read the status line: it tells you immediately whether the two documents are structurally identical or how many differences were found.
Work through the differences list, where each entry shows a path like items[2].price along with ADDED, REMOVED or CHANGED and the values involved.
Common mistakes
Examples
See also
- JSON Formatter — One side won't parse? Format it first — the formatter points at the offending character.
- CSV to JSON — Comparing two spreadsheet exports? Convert both to JSON and diff them structurally.
FAQ
Why does it say the documents are identical when the text clearly differs?
Because the comparison runs on the parsed structure, not on the raw characters. Object key order and indentation carry no meaning in JSON, so two documents that hold the same keys with the same values report as structurally identical no matter how they were written out.
How are arrays compared?
Arrays are compared element by element, by index: position 0 against position 0, position 1 against position 1, and so on. This means inserting or deleting an element near the start shifts everything after it and produces a difference at each shifted index rather than a single move entry.
Why are some of the reported values cut off?
Reported values are truncated to 60 characters so that a long string or a large embedded blob does not swamp the results list. The truncation affects only what is displayed — the comparison itself always uses the complete value, so a difference beyond character 60 is still detected.
Does a type change count as a difference?
Yes. Values are compared by type as well as by content, so a number turning into a string, such as 5 becoming "5", is reported as CHANGED at that path. This is deliberate, since type drift between an API version and its client is one of the failures a diff is most useful for catching.