JSON Diff — Compare Two JSON Documents
Compare two JSON documents side by side. Highlight added, removed, and changed keys. Runs entirely in your browser. No uploads, no limits.
Comparing two JSON documents is one of those tasks that sounds simple and then isn’t. A line-based diff (the diff command, VS Code’s source diff) sees JSON as text and flags every line that changed — which, for a minified JSON, is the entire document, and for a pretty-printed JSON, is every line that contains a changed value plus every line whose indentation shifted because a sibling was added or removed. A structural diff understands JSON as data and flags only the actual changes: this key was added, that key was removed, this value changed. The result is a focused list of differences rather than a wall of red and green lines.
The non-obvious decision is array order. JSON arrays are ordered lists, but the semantic meaning of that order varies by domain. A list of users is order-sensitive (the order may reflect a sort or a creation sequence). A list of tags on a blog post is often order-insensitive (the set of tags is what matters, not the order they were assigned). The default diff treats arrays as ordered — [1, 2, 3] and [3, 2, 1] are different. The ‘ignore array order’ toggle is the right pick for set-like arrays where the order is not semantically meaningful.
For a final hand-off: if the destination is a code review, the visual diff is the artifact — paste the output or a screenshot into the PR description. If the destination is a CI pipeline, JSON Patch (RFC 6902) is the format to emit — it specifies the changes as a list of operations (add, remove, replace, move, copy, test) that any compliant library can apply. If the destination is a data migration script, the path-by-path change list is the input — each path becomes a column-to-update statement or a document-to-revise call.
How to use
Paste two JSON documents
Drop the first JSON into the left panel and the second into the right panel. The diff runs automatically as you type, with additions, removals, and changes highlighted inline.
Pick a diff mode
Default is structural diff (key-by-key comparison, array order matters). Switch to semantic diff (treat `{a:1,b:2}` and `{b:2,a:1}` as equal) or deep diff with type-strict comparison.
Read the change list
The change list panel shows every difference as a path: `users[3].email` changed from `[email protected]` to `[email protected]`. Click a path to jump to that location in both source panels.
Frequently asked
Does array order matter in the diff?
By default yes — `[1, 2, 3]` and `[3, 2, 1]` are different. Toggle 'ignore array order' to compare arrays as sets, so the same elements in different positions are treated as equal. Useful for diffing API responses where field order is not semantically meaningful.
How are null and undefined treated?
JSON does not have `undefined`, only `null`. The diff treats `null` and a missing key as different — `{a: null}` and `{}` are not the same. Toggle 'treat null and missing as equal' if your schema considers them equivalent.
Will it detect value type changes?
Yes — a change from a string to a number, or from an object to an array, is flagged as a type change, not just a value change. The diff panel shows the type on both sides so the change is unambiguous.
Can I diff large JSON files?
Yes — the diff runs in-memory and handles files up to the browser tab's available memory. For multi-megabyte JSON, the UI may stall while parsing but the diff itself is fast (linear in document size). For very large documents, consider pre-filtering to the relevant subset.
Does it format the JSON before diffing?
Yes — both inputs are pretty-printed with consistent indentation before diffing. The format itself (2-space vs 4-space, key order) does not affect the diff result; only the values and structure matter.
Limitations
- No semantic JSON Schema awarenessThe diff is structural, not schema-aware. Two JSON values that are semantically equivalent under a JSON Schema (e.g., optional fields with default values) are flagged as different. For schema-aware diffs, post-process with a JSON Schema validator.
- Key order in objects is not a diffObject key order is ignored — `{a: 1, b: 2}` and `{b: 2, a: 1}` are treated as equal. The diff shows value changes, not reordering. If key order matters (rare, but possible in some legacy APIs), use a text diff tool instead.
- No patch outputThe tool displays the diff visually but does not emit a patch file (unified diff format, JSON Patch RFC 6902). For patch output suitable for automation, use a command-line tool that emits JSON Patch.
Platform notes
- macOS
- FileMerge and Kaleidoscope are visual diff tools that work on any text file. The browser tool is the right pick for JSON specifically, where structural awareness (key-by-key, array order) gives a clearer result than line-based diff.
- Windows
- WinMerge is the standard visual diff tool for Windows. The browser tool is the right pick for JSON specifically, where the structural diff highlights only the changed values rather than every line that contains them.
- Linux
- For command-line work, `diff -u` works on any text file but is line-based, not structure-aware. `jd` (JSON diff) and `jsondiff` are the closest CLI equivalents. The browser tool is the right pick for interactive diffing of JSON pasted from chat or email.
- Web
- Runs entirely client-side. Works offline once the page has loaded. Useful for ad-hoc diffs in restricted environments where command-line tools are not available, or for quick comparisons of API responses captured in a browser tab.