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.
Structural compare for JSON
With normalize on, key order and whitespace are irrelevant. The diff shows only true value/shape changes.
{"name":"Alice","age":30,"tags":["admin","user"]} {
- "age": 30,
+ "age": 31,
+ "city": "NYC",
"name": "Alice",
"tags": [
"admin",
- "user"
+ "verified"
]
}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.
How to diff JSON structurally
Paste before
Drop the original JSON into the left editor. Any whitespace works.
Paste after
Drop the modified JSON into the right editor.
Keep normalize on
Sorts keys and re-emits both sides with 2-space indent — so cosmetic differences vanish from the diff.
Copy or download
Grab the unified diff as json.diff or paste it into a PR.
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 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_INTEGERmay lose precision. - Very large documents are bound by
O(m × n)LCS table size.