JSON Diff

Compare two JSON documents and get a per-path verdict tree — equal, changed, added or removed — with counts, a copyable report and a download.

Both documents are diffed locally in your browser. Nothing ever leaves your device.

Diff result
—

Paste or load two JSON documents, then Compare (typing also refreshes after a short pause).

How It Works

Both panes are parsed with JSON.parse — a failure in either side is reported per pane and stops the comparison. The walker then descends both trees in parallel: objects are matched key by key, so the literal order keys appear in the file never produces a false diff; two scalars (or mismatched types) at the same location produce a verdict, and each path is shown in a bracket-dot notation like users[2].role.

Per-path verdicts
Every leaf gets one of four statuses. equal — both sides hold the same value. changed — a value sits at the same path on both sides but differs, shown as old → new. added — the key or index exists only on the right. removed — only on the left. Added and removed subtrees are printed as serialized JSON, truncated to 80 characters.
Arrays are aligned by index
Arrays are compared positionally: element 0 against element 0, and so on. That is the honest default for ordered data, but it is a different model from a set-like diff, which would match elements by content and report a single insertion where index alignment reports a cascade of changes. If your arrays are unordered collections, sort them in your own file first for a cleaner result.
Percent equal
The summary counts every verdict and reports the equal share: equal paths divided by all paths, rounded. Two identical documents therefore read 100 % equal, and the stat is computed on leaf verdicts, so a container that merely survives a child edit adds no weight of its own.

Frequently Asked Questions

How large can the JSON files be?

Everything runs in your tab's memory, so the practical limit is your device, not the tool. Documents up to roughly 5 MB compare smoothly on most machines; far larger files can make the recursive walk and the rendered tree sluggish. If a huge comparison stalls, trim both sides to the sections you actually need before pasting.

Can it show the diff sorted by path?

Paths appear in document order — object keys in the order they occur on the left side first (right-only keys after), then array indices ascending. There is no alphabetical sort toggle, because keeping the natural reading order makes it easier to line the result up against your own file. You can copy the text report and sort it externally if you prefer.

Can I compare two arrays directly?

Yes — the top-level value can be an array on both sides, and it is diffed index-wise like any other array. Just remember that index-wise means positional: if you insert one element at the front of a 100-item array, every later index shifts and the tool honestly reports a long chain of changed entries rather than a single insertion.

Why does reordering keys show as equal?

Because JSON objects are key/value maps, not ordered records, and a semantic diff should not care about serialization order. The walk matches keys by name, so moving a field between lines in the file produces no diff line at all. Arrays, by contrast, are ordered, so their element order does matter.

Is anything uploaded to a server?

No. Both documents are parsed and walked locally with vanilla JavaScript in your browser — even when you load them from disk, they are read with FileReader and never leave your device. There is no network request attached to a comparison.