DevKits

JSON Diff — Compare Two JSON Objects

Compare two JSON documents structurally and see added, removed, and changed values by path. Handles nested objects, arrays, and type changes.

Last updated:

Added1Removed0Changed3Type changed0Unchanged4
ChangePathLeftRight
Changed$.name"Ada Lovelace""Ada King"
Changed$.roles[1]"editor""owner"
Changed$.profile.age3637
Added$.profile.country"UK"

Paste two JSON documents above to compare them structurally. Added, removed, and changed values are highlighted by path, ignoring key order and formatting. Everything runs locally.

What is JSON Diff?

A JSON diff compares two JSON documents by structure rather than by text. Unlike a plain text diff — which is confused by reordered keys, different indentation, or whitespace — a structural diff parses both sides and reports exactly which values were added, removed, or changed, addressed by their path (e.g. user.address.city). This is essential for reviewing config changes, API contract drift, and snapshot test failures.

How to compare two JSON objects

  1. 1Paste the original JSON on the left and the updated JSON on the right.
  2. 2The tool parses both and computes a structural diff.
  3. 3Review changes grouped by path: additions, deletions, and value changes are color-coded.
  4. 4Use the by-path view to pinpoint exactly which nested field changed.

Use Cases

Review config changes

See exactly which settings changed between two versions of a config.json, ignoring key reordering.

Debug API contract drift

Compare a recorded response with a fresh one to spot fields that were added, removed, or retyped.

Explain snapshot test failures

Diff the expected vs actual JSON snapshot to understand why a test broke without eyeballing two blobs.

Code Examples

Left (original)

{ "name": "web", "replicas": 2 }

Right (updated)

{ "name": "web", "replicas": 3, "tls": true }

Diff result

~ replicas: 2 -> 3
+ tls: true

Key Concepts

Structural vs text diff
A text diff compares characters and is fooled by reordered keys or whitespace. A structural diff parses JSON first, so only real value changes are reported.
Path addressing
Each change is labeled by its location, e.g. items[2].price. This is a JSON Pointer / dot-path style that pinpoints deep changes.
Array comparison
Arrays are compared by index. Inserting an item mid-array shifts positions and can appear as many changes — a known limitation of index-based diffing.

Tips & Best Practices

  • Reordered object keys are treated as identical — that's the whole point of a structural diff.
  • Inserting an element in the middle of a large array can look like many changes because comparison is index-based.
  • A type change (e.g. "3" string → 3 number) is reported as a change, not equal — JSON diffs are type-aware.
  • For very large documents, collapse unchanged branches to focus on the deltas.

Frequently Asked Questions

How is this different from a plain text diff?

A text diff compares byte by byte and is sensitive to key order, whitespace, and formatting. This tool parses both inputs as JSON first and compares them structurally — so re-ordered keys and different indentation are correctly reported as identical.

How are arrays compared?

Arrays are compared by index: position 0 in the left is compared with position 0 in the right. Insertions or deletions in the middle of large arrays will therefore appear as many changes; use the flat 'by path' view to see the exact differences.

Is my JSON uploaded anywhere?

No. The comparison runs entirely in your browser as pure JavaScript. Both inputs stay on your device.

Related Tools