JSON Diff – Compare Two JSON Documents
Paste two JSON documents to see every added, removed and changed value with its exact path. Export the differences as a JSON Patch.
| Change | Path | A (old) | B (new) |
|---|---|---|---|
| Changed | "alice@example.com" | "alice@example.org" | |
| Added | roles[1] | — | "editor" |
| Changed | settings.theme | "dark" | "light" |
| Removed | settings.notifications | true | — |
| Changednull → string | lastLogin | null | "2026-11-02T09:15:00Z" |
What this JSON diff does
A plain text diff is a poor fit for JSON: reformatting a file, reordering keys or changing indentation produces dozens of "changes" that mean nothing. This tool parses both documents and compares the data itself. It walks every nested object and array and lists each real difference with its path, the old value and the new value. Typical uses are checking what changed between two API responses, comparing a config file across environments, reviewing a data migration, or finding why a test fixture no longer matches.
How to use it
- Paste the earlier version into Original JSON (A) and the newer one into Modified JSON (B).
- The comparison updates as you type. A parse error appears under the panel that contains invalid JSON.
- Use the Added, Removed and Changed chips to filter the table.
- Tick Ignore array order if your arrays are sets (tags, permissions, IDs) rather than ordered lists.
- Click JSON Patch to get a machine-applicable patch, then Copy patch or Download. Copy report copies the table as plain text.
Worked example
The built-in example compares these two user records:
A: {"id":42,"name":"Alice","email":"alice@example.com","roles":["admin"],
"settings":{"theme":"dark","notifications":true},"lastLogin":null}
B: {"id":42,"name":"Alice","email":"alice@example.org","roles":["admin","editor"],
"settings":{"theme":"light"},"lastLogin":"2026-11-02T09:15:00Z"}The tool reports five differences:
~ email: "alice@example.com" -> "alice@example.org" + roles[1]: "editor" ~ settings.theme: "dark" -> "light" - settings.notifications: true ~ lastLogin: null -> "2026-11-02T09:15:00Z" (type change null → string)
and this JSON Patch, which turns A into B exactly:
[
{ "op": "replace", "path": "/email", "value": "alice@example.org" },
{ "op": "add", "path": "/roles/1", "value": "editor" },
{ "op": "replace", "path": "/settings/theme", "value": "light" },
{ "op": "remove", "path": "/settings/notifications" },
{ "op": "replace", "path": "/lastLogin", "value": "2026-11-02T09:15:00Z" }
]Note that id and name do not appear: identical values are not listed.
Reading the result
- Path uses JavaScript notation: a.b for keys, [2] for array indexes, and ["first name"] for keys that are not valid identifiers. (root) means the two documents differ at the top level, for example an object versus an array.
- Changed rows show the old and new value. When the JSON type changes (number to string, null to object…) the row says so, which is a common source of client bugs.
- Arrays, default mode: items are compared index by index. Extra items at the end are added or removed. Inserting an item at the start therefore shows every following index as changed, which is correct for ordered data.
- Arrays, Ignore array order: items are matched by deep equality regardless of position, so [1,2,3] and [3,1,2] are equal. A modified object inside such an array is shown as one removed item plus one added item, because there is no index to tie them together.
- JSON Patch paths are RFC 6901 pointers: / separates segments, and a key containing / or ~ is escaped as ~1 or ~0. Removals from the same array are emitted from the highest index down so they apply cleanly.
Limitations
- Inputs must be strict JSON. Comments, trailing commas and single quotes are rejected — clean them up first with the JSON Formatter.
- Numbers are compared after parsing, so 1.0 and 1 are equal, and integers beyond 253 lose precision as in any JavaScript program.
- There is no move detection: an item that moved within an ordered array shows up as changes at both positions.
- Inputs are limited to 5 MB each and the table shows the first 2,000 rows (the copied report contains all of them). Unordered array matching compares every pair of items, so very large arrays are slow in that mode.
Tips
- To explore a large response before diffing it, open it in the JSON Viewer and copy only the branch you care about.
- Volatile fields such as timestamps or request IDs will always differ; delete them from both sides to focus on meaningful changes.
- For prose or code rather than data, a line-based comparison is more useful — use the Text Diff tool.
Frequently Asked Questions
Does the JSON diff compare nested objects and arrays?
Yes. The comparison is recursive: every nested object and array is walked, and each difference is reported with its full path, such as settings.theme or items[3].price.
Does key order matter when comparing JSON?
No. JSON objects are unordered, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical. Array order does matter by default, because [1,2] and [2,1] are different JSON values.
How do I compare arrays when the order of items does not matter?
Tick "Ignore array order". Arrays are then treated as unordered lists: each item in A is matched with an identical item in B, and only the leftovers are reported as removed or added.
What is the JSON Patch output?
It is an RFC 6902 patch: a list of add, remove and replace operations that turns document A into document B. You can apply it with libraries such as fast-json-patch (JavaScript) or jsonpatch (Python). It is only available when array order is respected.
Why is a whole array element shown as changed instead of individual fields?
When both elements at the same index are objects, the diff goes inside them and reports field-level changes. A whole value is reported as changed only when its type differs, for example a string replaced by an object.
Is my JSON sent to a server?
No. Both documents are parsed and compared by JavaScript in your browser. Nothing is uploaded or stored.
Related tools
- JSON ViewerView, validate and explore JSON with syntax highlighting and interactive tree view
- JSON FormatterFormat and beautify JSON with syntax highlighting and validation
- CSV ↔ JSON ConverterConvert between CSV and JSON formats
- Excel to JSON ConverterConvert Excel, ODS or CSV sheets to JSON — or JSON arrays back to .xlsx. Choose sheet, header row, date and empty-cell handling. 100% client-side.
- JSON to TypeScriptGenerate TypeScript interfaces from JSON objects
- XML ViewerValidate, format, and explore XML documents with an interactive collapsible tree view. Supports .xml, .xsd, .svg, .rss, .plist and any XML-based format. Runs entirely in your browser.
Found a bug or a wrong result? Report it.