JSON Diff

Compare two JSON objects side-by-side with colored diff highlighting

About JSON Diff

JSON Diff compares two JSON documents and highlights exactly what changed — added keys are shown in green, removed keys in red, and modified values in yellow. It is invaluable when reviewing API response changes, comparing config file versions, or debugging why data looks different than expected. The diff is shown inline with full context so you can see the whole structure at once.

  • ✓Color-coded diff: green for additions, red for deletions, yellow for changes
  • ✓Shows the full document with changes highlighted in context
  • ✓Handles deeply nested objects and arrays
  • ✓Ignores key order by default — compares values semantically, not textually

Comparing JSON the Right Way

Comparing two JSON documents sounds like a job for a plain text diff — until you realize that `{"a":1,"b":2}` and `{"b":2,"a":1}` represent identical data but would show as completely different lines in a text diff. A proper JSON diff compares the data itself, not its textual representation.

Why text diffs fail on JSON

  • ·Key order — JSON objects are unordered by spec, so reordering keys changes every line in a text diff while changing nothing about the data
  • ·Whitespace and formatting — minified vs. formatted versions of the same document look wildly different to a line-based diff tool but are semantically identical
  • ·Nesting — a single added field deep in a structure can shift every subsequent line, burying the real change in noise

A semantic JSON diff sidesteps all of this by parsing both documents first and comparing the resulting data structures — so the only differences reported are differences that actually matter.

How to read the highlighted output

{
  "id": 42,
  "name": "Alice",        ← unchanged
- "role": "editor",       ← removed (shown in red)
+ "role": "admin",        ← added with new value (shown in green)
  "active": true,
+ "lastLogin": "2026-06-01"  ← new key added (green)
}

Modified values typically appear as a paired removal and addition (old value in red, new value in green) so you can see exactly what changed at that key, rather than just "something here is different".

A note on array comparison

  • ·Arrays are ordered, so array comparison is positional — element 0 is compared with element 0, element 1 with element 1, and so on
  • ·Inserting an element at the start of an array will show every subsequent element as "changed", even though the data simply shifted — this is a fundamental property of index-based comparison, not a bug
  • ·If your data uses arrays as unordered sets (e.g., a list of tags), consider sorting both arrays before comparing, or comparing them as sets in your own code, to avoid noisy false positives

Where this fits in a developer workflow

  • ·API contract changes — paste the response from before and after a backend deploy to confirm only the intended fields changed
  • ·Config and infrastructure review — compare two versions of a JSON config to spot accidental changes before they ship
  • ·Debugging data pipelines — confirm that a transformation step produced exactly the expected output, field by field
  • ·Snapshot testing — manually inspect why a test snapshot comparison failed by pasting the expected and actual JSON side by side

Tip: If the documents you are comparing use different key ordering or formatting on purpose (e.g., one came from an old API version), run them both through the JSON Formatter first with the same indent settings — it won't change the diff result, but it makes the "unchanged" context easier to read at a glance.

Frequently Asked Questions

Ad