Compare two JSON documents by structure, not by text
A text diff between two JSON payloads is dominated by reordering, which is noise. This comparator walks both documents in parallel and reports what actually changed: which paths were added, removed or given a different value.
- Comparison
- Structural
- Ignores
- Key order, whitespace
- Paths
- Dotted with indices
Paste two JSON documents and compare them to see their structure.
Measured on Apple M4 Max: 1.02 ms compare two documents by structure (2,000 records each, 5% changed) See the benchmarks
How to use it
- Paste both documents Two JSON values, one per box. Order does not matter: the comparator matches keys by name, not by position.
- Read the difference list Every difference is reported with a path, the type of change and the two values involved.
- Work through the list Filter to only the changes you care about, and copy the result into a ticket or a test fixture.
Reference
What a structural diff reports
| Path | Change |
|---|---|
| `user.address.city` | Changed: `"Lisbon"` → `"Porto"` |
| `user.tags[2]` | Added: `"beta"` |
| `legacy_id` | Removed: `10422` |
| `items[0].qty` | Changed type: `2` → `"2"` |
Questions people ask
How are arrays compared?
Positionally, index by index, and the path includes the index. An item that exists at index 3 in one document and not the other is reported as added or removed at that position.
Does key order matter?
No. Objects are matched by key name, so a payload with the same data in a different order produces no differences.
Can it ignore specific fields?
Not in this version. Ignore volatile fields such as timestamps and request ids before comparing, or compare only the subtree you care about.
What is the difference between this and the text diff tool?
The text diff compares lines of text. This one compares parsed documents. For JSON, the structural view is the useful one, because a reordering in a text diff looks like a rewrite.
Does it handle deeply nested documents?
Yes, the walk is recursive, and the path notation identifies exactly where a difference lives, for example `a.b[0].c.d`.
Why does it say a value changed when the two look the same?
Almost always a type difference. The number 2 and the string "2" are different values in JSON, and the comparison treats them as such, which is exactly the class of change that breaks a downstream parser.
Details that catch people out
Objects are compared by key name because object key order carries no meaning in JSON. Arrays are compared positionally because in most APIs the order does carry meaning. If yours does not, sort before comparing.
The number 2 and the string "2" are reported as different, with the type change noted. This catches a real class of bug where a serialiser starts quoting a numeric id.
Where this earns its keep
Comparing two API environments
A staging response against a production response, compared structurally, shows the field that a deploy added or renamed without the noise of reordering.
Writing a regression test
Turn an unexpected response change into an explicit list of assertions instead of a large string snapshot that fails for unrelated reasons.
Validating a migration
After a data migration, compare the migrated output against the original and confirm that only the intended fields differ.
Guides that go deeper
- What a Useful Diff Looks Like 6 min read · Why line diffs are too coarse, when word-level highlighting helps, and how structural…
Last reviewed 2026-10-04. Every tool on DevSnap runs entirely in your browser, so whatever you paste here never reaches a server.