Compare two JSON files
Open both files and compare them side by side, as a unified diff with word-level highlighting, or structurally — where the parsed data is compared, so a reindented file reads as unchanged rather than as every line rewritten.
Why a line diff is the wrong tool for JSON
Run a text diff over two JSON files where one has been through a formatter and every line is red. Somewhere in that wall is the one value that actually changed, and the diff has given you no help finding it. The problem is that a line diff compares the text, and the text is not what you care about.
Three ways to compare
- Split
- The two documents side by side in the editor, with changed regions aligned, unchanged stretches collapsed, and the gutters marked. Scrolling is synchronised, and next/previous jump between changes.
- Unified
- One column, additions and removals interleaved, with word-level highlighting inside lines that were edited rather than replaced — so "port 8080 became 9090" reads as two changed characters, not two changed lines. Unchanged stretches collapse to a count, and the whole thing exports as a .patch file that git apply accepts.
- Structural
- The parsed data, compared key by key. Added, removed, changed and type-changed are reported separately, each with its JSONPath. Reformatting produces no output at all, because no data changed.
Type changes are called out separately
A field going from the string "8080" to the number 8080 is not the same kind of change as a value being edited, and it is the kind that breaks things downstream. The structural diff reports it as its own category rather than folding it in with ordinary value changes.
Questions
How do I compare two JSON files?
Open both files in fileviewer.dev, switch to the Diff view, and pick the second file from the "compare against" list. Choose split, unified or structural depending on whether you care about the text or the data.
How do I diff JSON while ignoring formatting?
Use the structural mode. It compares the parsed documents rather than their text, so differences in indentation, key order and whitespace produce no output — only genuine data changes are listed, each with its path.
Can I export the diff?
Yes. The unified view exports a standard .patch file with proper hunk headers, which git apply accepts — so the diff can be read by a person or applied by a tool.
Are both files uploaded to compare them?
No. Both are read and diffed in your browser. Above about a quarter of a megabyte the diff runs in a Web Worker so the interface stays responsive, but it never leaves your machine.