Guides Knowledge Base

Compare Two JSON Files Online

Compare two JSON files online and see every added, removed and modified key. Structural comparison ignores key order and indentation. Free, nothing uploaded.

To compare two JSON files, paste the original into the first pane and the modified version into the second. The comparison runs on structure rather than text, so reordered keys and different indentation are not reported — only real changes to keys and values.

Structural vs Textual Comparison

A line-based tool such as diff reports every changed line, so re-indenting a file or reordering its keys shows up as a wholesale rewrite. A structural comparison parses both documents first and walks the resulting trees, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical. That is almost always what you want when the question is "what actually changed?".

What Gets Reported

  • Added — a key path present in the second file only.
  • Removed — a key path present in the first file only.
  • Modified — the same key path with a different value or type.

Each result is labelled with its full path, such as user.address.city or items[2].price, so you can find it in the source file without hunting.

Arrays Are Compared by Position

JSON arrays are ordered, so element 0 is compared against element 0. Inserting a record at the front of a list therefore shifts every later element and reports a long run of modifications. When your arrays are really unordered sets keyed by id, sort both files by that id before comparing — the JSON Formatter's key sorting handles the object side of the same problem.

Comparing Files on the Command Line

# Normalise both, then diff — sorted keys, compact output
diff <(jq -S -c . a.json) <(jq -S -c . b.json)

Who this guide is for

  • Compare a config file before and after a deployment
  • Check what changed between two versions of an API response
  • Verify a migration produced the records you expected
  • Review a pull request whose diff is buried in reformatted JSON

Try the free JSON Diff

Runs entirely in your browser — no upload, no signup, and your data never leaves your device.

Open JSON Diff

Frequently Asked Questions

Does the comparison care about key order?

No. Both documents are parsed before comparison, and JSON objects are unordered by definition, so reordering keys produces no differences.

Can I compare two files rather than pasting text?

Yes — load a file into each pane. Reading happens locally in the browser; neither file is uploaded anywhere.

Why does one inserted array element report so many changes?

Arrays are ordered, so an insertion shifts every subsequent index and each shifted position counts as a modification. Sort both arrays by a stable key first if order is not meaningful in your data.

Tools mentioned in this guide

Related JSON Topics & Reference Articles