JSON Diff Checker — compare two JSON documents
Paste two JSON documents and see only the real changes — every added, removed, and changed value by path, ignoring key order and formatting. You also get a copyable RFC 6902 JSON Patch. It runs entirely in your browser, so nothing is uploaded.
How it works
A line-based diff treats JSON as plain text, so it flags a reordered key or a change in indentation as a difference even when the data is identical. This tool does a structural comparison instead: it parses both documents into values and compares those values, so only genuine semantic changes are reported. The method is deterministic — the same two inputs always produce the same result.
- Parse. Both sides are parsed against the strict JSON grammar defined by RFC 8259 and ECMA-404. If either fails, the exact parser error with its line and column is shown and no diff is produced — you never see a misleading partial comparison.
- Compare recursively. Two objects are compared by the union of their keys: a key only in A is removed, only in B is added, and in both is compared recursively. Because RFC 8259 §4 defines an object as an unordered collection of name/value pairs, key order is never itself a difference. Two arrays are compared element by element by index (positional); trailing extras in B are added and trailing extras in A are removed. Two primitives are equal only when they share a JSON type and value.
- Handle numbers and types. A JSON number denotes a value (RFC 8259 §6), so
1,1.0, and1e0compare equal. A value whose JSON type changes — a number becoming a string, or an object becoming an array — is reported as a type change rather than a silent value change. - Label every change. Each difference carries its JSON Pointer (RFC 6901), built segment by segment, escaping
~as~0and/as~1inside keys — for example/user/roles/1. - Emit a patch. Each change maps to an RFC 6902 operation: added →
add, removed →remove, changed →replace. Array removals are ordered highest-index-first so the patch applies cleanly in sequence.
To prove the result is correct, the tool cross-checks itself: it applies the patch it just produced back to document A and confirms the outcome equals document B, value for value. The Verified · patch round-trips badge turns green only when that independent second computation succeeds — the same idea as double-entry verification.
Worked examples
Frequently asked questions
Sources & references
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- ECMA-404 — The JSON Data Interchange Syntax
- RFC 6901 — JavaScript Object Notation (JSON) Pointer
- RFC 6902 — JavaScript Object Notation (JSON) Patch
The comparison rules and pointer/patch formats on this page were last cross-checked against these standards on 2026-07-08. Every diff is additionally self-verified at runtime by round-tripping its patch.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.