JSON Diff
Paste two JSON objects to compare them. Differences are highlighted instantly.
JSON A (original)
VS
JSON B (modified)
Paste JSON in both panels
Differences appear here automatically
Paste JSON in both panels to comparedeep comparison · all nesting levels
What is JSON Diff?
JSON diff compares two JSON objects and shows exactly what changed between them. Unlike a plain text diff that compares line by line, a JSON diff understands the structure — so two objects with the same keys in different order still show as identical.
How to Read the Results
+
Added — Key exists in JSON B (right) but not in JSON A (left)
−
Removed — Key exists in JSON A (left) but not in JSON B (right)
≠
Changed — Key exists in both but values differ — old value → new value
Example
JSON A (original)
json
{
"name": "Ravi",
"age": 28,
"city": "Surat"
}JSON B (modified)
json
{
"name": "Ravi",
"age": 30,
"email": "ravi@example.com"
}Result: age changed 28→30, city removed, email added.
Use Cases
- ▸API response testing — Verify only expected fields changed after a backend update
- ▸Configuration comparison — Diff two versions of a config file to see what settings changed
- ▸Database record debug — Export before/after states as JSON and find exactly what changed
- ▸Code review — Compare old and new JSON fixture files to get a clean change summary
- ▸Feature flags — Compare production vs staging config to spot inconsistencies
JSON Diff in Code
JavaScript:
js
function diffObjects(left, right, prefix = "") {
const changes = [];
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
for (const key of keys) {
const fullKey = prefix ? prefix + "." + key : key;
if (!(key in left)) { changes.push({ type: "added", key: fullKey, value: right[key] }); continue; }
if (!(key in right)) { changes.push({ type: "removed", key: fullKey, value: left[key] }); continue; }
if (JSON.stringify(left[key]) !== JSON.stringify(right[key])) {
changes.push({ type: "changed", key: fullKey, left: left[key], right: right[key] });
}
}
return changes;
}