JSON Diff

Compare two JSON documents by structure, not by text. The diff lists every added, removed and changed value with its path, such as $.roles[1] or $['a.b']. Key order, indentation and whitespace are ignored, so two API responses that only differ in formatting come out identical. Both documents are parsed and compared in your browser.

How to use the JSON Diff

  1. Paste the earlier document into Old and the later one into New.
  2. Press Diff. If either side is not valid JSON, the parser's error message tells you which side and where.
  3. Read the table: add means the path exists only in New, remove only in Old, change means the value at that path differs.

Load example compares {"name":"Alice","age":30,"roles":["admin","user"],"active":true} with a version where the age is 31, the user role is gone and an email was added. The result is three rows: change $.age 30 → 31, remove $.roles[1] "user" and add $.email "[email protected]". The unchanged name and active fields are not listed.

Paths use the same notation as the JSONPath Tester, so you can paste one there to inspect the surrounding data.

Structural diff vs text diff

A text diff compares lines. Reformat a JSON file, sort its keys or change the indentation, and a text diff reports nearly every line as changed although the data is the same. A structural diff parses both documents into values first and compares those, so it reports only differences in the data itself.

How this diff decides what changed:

  • Objects are compared key by key, and key order does not matter: {"a":1,"b":2} and {"b":2,"a":1} are identical.
  • Arrays are compared position by position. This is the main thing to know: inserting an element at the front of ["b","c"] to get ["a","b","c"] is reported as $[0] changed from "b" to "a", $[1] changed from "c" to "b", and $[2] added. The diff does not try to detect moved or inserted elements.
  • Types matter. 8080 and "8080" are different values, so {"port":8080} against {"port":"8080"} is a change at $.port. A value that turns from null, an array or a number into an object is one change at that path, not a list of added keys.
  • Numbers are compared after parsing, so 1 and 1.0 are equal.

Keys that are not plain identifiers are written in bracket form: a change to the key "a.b" appears as $['a.b'], never as the misleading $.a.b.

Common use cases

  • Comparing API responses from two environments (staging and production) or from before and after a deploy, where field order and formatting often differ.
  • Reviewing configuration changes in package.json, tsconfig.json, feature-flag exports or infrastructure state, where only the changed settings matter.
  • Checking a migration or transform: run the old and the new code on the same input and diff the outputs.
  • Debugging snapshot tests when a stored JSON snapshot no longer matches and the text diff is too noisy to read.

Limits

  • Arrays are compared by index, so reordered or inserted elements show up as several changes (see above). For lists of records, compare them sorted by a stable key.
  • Long values are shortened to 80 characters in the table; the path still points to the full value.
  • Both inputs must be strict JSON: no comments, no trailing commas, double-quoted keys.

Frequently asked questions

Why does adding one item to an array show several changes?

Arrays are compared by position. Inserting at index 0 shifts every later element, so each shifted position is reported as changed and the last one as added.

Does the order of keys matter?

No. Objects are compared key by key, so documents with the same keys and values in a different order are reported as structurally identical.

Is "8080" the same as 8080?

No. A string and a number are different JSON values, so the diff reports a change. 1 and 1.0, however, are the same number.

Are my documents uploaded?

No. Both documents are parsed and compared in your browser; the page makes no request with your input.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: