JSON Compare
Compare two JSON files or snippets side by side and spot changed values, missing keys, added fields, and type mismatches. Everything runs privately in your browser.
How to compare two JSON documents
Paste two versions, compare them, and get every added, removed and changed value by path.
- 01
Paste the original on the left and the new version on the right
Both sides load with a sample so you can see the output first. Each side must be valid JSON; if one isn't, the tool says which.
- 02
Compare
The tool walks both documents and lists every difference by path, such as $.plan.seats, with the old and new value side by side.
- 03
Read the type of each change
Added means the key exists only on the right, removed only on the left, changed means the value differs, and type changed means it went from, say, a number to a string.
- 04
Use Format to tidy both sides
Format re-indents both inputs, which makes them easier to scan alongside the list of differences.
Worked example: what the comparison reports
Say the left side is {"name":"Asha","age":30,"tags":["a","b"],"plan":{"tier":"pro","seats":5},"active":true}. The right side moves active to the front, sends age as a string, inserts "x" at the start of tags, bumps seats to 6 and adds an email. We ran exactly that through the tool:
| Change | Path | Left | Right |
|---|---|---|---|
| Type changed | $.age | 30 | "30" |
| Added | (missing) | "[email protected]" | |
| Changed | $.plan.seats | 5 | 6 |
| Changed | $.tags[0] | "a" | "x" |
| Changed | $.tags[1] | "b" | "a" |
| Added | $.tags[2] | (missing) | "b" |
Three things stand out. Moving active to the front isn't reported, because key order doesn't matter in JSON objects. The age row is a type change, which is exactly the kind of bug that breaks a strict API client. And inserting one item at the start of tags shows up as three differences, because arrays are compared position by position.
How the comparison works
Both sides are parsed with JSON.parse, so whitespace, indentation and key order make no difference. Objects are compared key by key, in sorted key order, and nested objects are followed all the way down. Arrays are compared index by index: item 0 with item 0, item 1 with item 1, and any extra items count as added or removed. Primitive values are compared exactly, so 1 and "1" are different, and true and "true" are different.
Position-by-position comparison is the right model for arrays where order matters, such as steps or coordinates. For arrays that are really sets, such as a list of tags or user IDs, sort both sides first in your code or editor, or the diff will be noisier than the actual change.
When a JSON diff helps
Spotting what an API change broke
Paste a response from before and after a deploy. Type changes and removed fields are the usual culprits when a client stops working.
Reviewing config changes
Compare two environment configs to see which settings differ between staging and production.
Checking a migration or export
Compare a record before and after a data migration to confirm nothing was dropped or changed type along the way.
Limits worth knowing
- Arrays aren't matched by content, so reordering or inserting items shows several changes, as in the example.
- Large integers above 9,007,199,254,740,991 are rounded when parsed, so two different 64-bit IDs can compare as equal.
- There's no option to ignore keys, such as timestamps or request IDs that always differ. Remove them from both sides first.
- It compares two documents at a time and shows a list, not a merged view. For raw text line by line, use the Diff Checker.