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 testingVerify only expected fields changed after a backend update
  • Configuration comparisonDiff two versions of a config file to see what settings changed
  • Database record debugExport before/after states as JSON and find exactly what changed
  • Code reviewCompare old and new JSON fixture files to get a clean change summary
  • Feature flagsCompare 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;
}

Frequently Asked Questions

No. JSON diff compares data structure, not text. Two objects with the same keys in different order are treated as identical.

Yes. The diff engine is recursive and compares every nesting level. If one field inside a deeply nested object changed, that specific key path is shown.

It beautifies both panels before comparing. Useful when one paste comes from a minified source — formatting first makes the raw text easier to review.

Yes. Arrays are compared by index. If an item is added, removed or changed at any position, it appears in the diff results.

Related Tools