HCODX/JSON Diff
100% browser-based · Normalized + sorted · Line-based output

JSON Diff

Compare two JSON documents structurally. Both sides are parsed and re-emitted with sorted keys (when the toggle is on) before line-by-line diffing — eliminating whitespace and key-order noise.

Before
After
Diff options
Open in text diff
Diff result
Left size
0 B
Right size
0 B
Changes
0
Status
Ready
Example

Structural compare for JSON

With normalize on, key order and whitespace are irrelevant. The diff shows only true value/shape changes.

Before
{"name":"Alice","age":30,"tags":["admin","user"]}
Diff
  {
- "age": 30,
+ "age": 31,
+ "city": "NYC",
  "name": "Alice",
  "tags": [
    "admin",
-   "user"
+   "verified"
  ]
  }
Use cases

What you'll use this for

Wherever JSON drives a system — config, contracts, snapshots — and you need to see what changed without whitespace noise.

API contract changes

Diff two API responses or OpenAPI snapshots to spot breaking shape changes.

Config diffs

Compare two environment configs (prod vs staging) to find environment drift.

Schema evolution

Track JSON Schema changes between versions of your data model.

Snapshot tests

Review snapshot diffs locally before approving them in your test runner.

Step by step

How to diff JSON structurally

1

Paste before

Drop the original JSON into the left editor. Any whitespace works.

2

Paste after

Drop the modified JSON into the right editor.

3

Keep normalize on

Sorts keys and re-emits both sides with 2-space indent — so cosmetic differences vanish from the diff.

4

Copy or download

Grab the unified diff as json.diff or paste it into a PR.

FAQ

Frequently asked questions

Both sides are parsed as JSON, keys are sorted alphabetically at every level, and the result is re-emitted with consistent 2-space indentation. This removes whitespace and key-order differences before the line diff runs.

Yes, indirectly. After sort-and-stringify, two semantically equal JSON values produce identical text, so the line diff reports no changes. Array element order is preserved (arrays are ordered in JSON).

Yes. Completely free, no signup, no limits. Both documents stay in your browser.

The tool surfaces the parse error inline in the diff output. Either fix it, or turn off normalize to fall back to a raw text diff. Use the JSON Validator to pinpoint the problem.

Click the swap arrows in the After header — it flips the two sides and re-runs the diff so additions and deletions swap.

About

About structural JSON diffing

A raw text diff over JSON gets noisy fast — reformatting, key-order changes, or trailing-comma fixes all show up as changes even when the data is identical. Structural diff normalizes both sides first, so only real semantic differences remain.

How normalization works

  • Both inputs are parsed with JSON.parse.
  • Object keys are recursively sorted alphabetically.
  • Both sides are re-emitted with JSON.stringify(value, null, 2).
  • The two normalized strings are passed to the line-based LCS diff.

Limits

  • Arrays are order-sensitive — reordered arrays show up as diffs.
  • Number precision follows JS — values beyond Number.MAX_SAFE_INTEGER may lose precision.
  • Very large documents are bound by O(m × n) LCS table size.
Related

Related tools