How to compare JSON
- Paste the old version into Original and the new one into Changed.
- The diff runs as you type; Compare or Ctrl + Enter runs it again.
- Read the counts, the changed paths, then the line diff.
Both sides are kept between visits.
Example
Original:
{
"plan": "pro",
"seats": 5,
"addons": ["sso", "audit-log"],
"billing": { "cycle": "monthly", "currency": "USD" }
}
Changed:
{
"billing": { "currency": "USD", "cycle": "yearly" },
"plan": "pro",
"seats": 8,
"addons": ["audit-log"],
"trialEnds": null
}
Result:
+ 1 added − 1 removed ~ 3 changed
$.addons[0] "sso" → "audit-log"
$.addons[1] "audit-log" removed
$.billing.cycle "monthly" → "yearly"
$.seats 5 → 8
$.trialEnds null added
billing moved and its keys swapped places, which is not a change. Removing "sso" from the front of addons shows as a change at [0] and a removal at [1], because arrays are compared by position; the line diff shows it as one removed line.
How JSON diff compares values
- Objects by key, so key order never appears in the list.
- Arrays by index.
- Values by type and value:
1and"1"differ;1.0equals1and1e3equals1000. nullon one side and a missing key on the other is listed as added or removed.- An object or array on one side only is listed once, with its whole value.
Whitespace never matters: both sides are parsed and re-indented with 2 spaces for the line diff, so there is no need to run them through the JSON formatter first.
Ignore key order
On by default: both documents are sorted by key before the line diff, so moved keys don’t flood it. Off shows each document in its own order; the path list finds the same changes either way. Sort JSON keys sorts a file for good.
Limits
The list shows the first 500 changes; the counts include all. Past 4,000 line edits, the line diff stops aligning and shows the old text, then the new. Both sides must be valid JSON: the status bar names the side and line with the error, and the JSON validator explains it. To explore one document, use the JSON viewer.