01 / JSON / json-diff

JSON Diff

Compare two JSON documents structurally.

ReadyLocal processing
01 · Workspace

How to use

  1. 01Paste the original JSON into the Original panel on the left.
  2. 02Paste the new version into the Changed panel on the right.
  3. 03Press Compare. If either document fails to parse, the parser's error appears next to the buttons.
  4. 04Review the Differences panel. Each line is labeled ADDED, REMOVED or CHANGED with its JSON path, and the header shows the total number of changes.
  5. 05Press Copy diff to copy a plain-text report, or Clear to reset the results while keeping both inputs.

What is this tool?

This is a structural JSON diff. Instead of comparing lines of text, it parses both documents and walks them key by key, reporting each difference with a JSONPath-style location such as $.user.email or $.items[2]. Objects are matched by key, so reordered keys, indentation and line breaks never show up as differences. Arrays are matched by position. When both documents hold the same data, the tool says they are identical. Both documents stay in your browser.

How a structural JSON diff differs from a text diff

A line-based diff, such as git diff, treats JSON as plain text. If one side is minified and the other pretty-printed, or a serializer emits keys in a different order, every line appears changed even though the data is the same. A structural diff compares the parsed values, so {"a":1,"b":2} and a multi-line version of {"b": 2, "a": 1} are reported as identical.

The tool's sample shows the output format. The original has version 1 and tags ["a"], and the changed document has version 2 and tags ["a", "b"]. Compare reports two changes: CHANGED $.version 1 → 2, and ADDED $.tags[1] "b". Values are shown as JSON, so a string keeps its quotes, and a change from "1" to 1 is visible as a type change.

When a value changes type, for example from an object to null or from an object to an array, the tool reports one CHANGED entry at that path with both full values, rather than listing every key inside.

How arrays are compared, and why insertions look noisy

Arrays are compared index by index, so the diff is exact when items are edited in place or appended at the end. An insertion near the start shifts every later item, though. Comparing [1, 2, 3] with [0, 1, 2, 3] reports CHANGED at $[0], $[1] and $[2], plus ADDED $[3], even though only one value was inserted.

If you're comparing lists whose order doesn't matter, such as records returned without an ORDER BY, sort both arrays by a stable key before comparing. Otherwise a harmless reordering shows up as a wall of changes.

Paths start at $, the document root. Object keys are joined with dots and array positions are shown in brackets, so $.orders[0].items[3].sku points to the sku of the fourth item in the first order. You can paste that path into a JSONPath tester to pull the same value out of either document.

Common use cases

  • Spotting API response regressions between two releases or environments
  • Reviewing a configuration change before deployment, ignoring formatting noise
  • Understanding why a snapshot test failed by seeing exactly which paths changed
  • Comparing a minified payload against a pretty-printed one without reformatting either
  • Checking that a serializer or migration preserved every field

FAQ

How do I compare two JSON files?

Paste one document into Original and the other into Changed, then press Compare. Each difference is listed with its JSON path and labeled as added, removed or changed.

Does key order matter?

No. Objects are compared by key, so the same keys in a different order are not reported as differences. Whitespace and indentation are ignored too.

Are arrays compared by index?

Yes. Items are compared position by position, so inserting or removing an item near the start of an array marks every later index as changed.

What do ADDED, REMOVED and CHANGED mean?

ADDED is a path that only exists in the changed document, REMOVED only exists in the original, and CHANGED exists in both with different values or types.

Can I export the diff?

Yes. Copy diff copies a plain-text report with one line per difference, such as CHANGED $.version : 1 -> 2.

Why does Compare show an error?

One of the two inputs isn't valid JSON. The message comes from the parser and doesn't say which side failed, so check both panels, or run each through the JSON Formatter.

Is my data uploaded?

No. Both documents are parsed and compared in your browser.