JSON Diff Tool
Compare two JSON documents side by side and highlight changed lines visually.
Why two semantically identical JSON documents can still show as different here
Both inputs are parsed and re-serialized before comparing, which normalizes whitespace and indentation — but not key order. {"a":1,"b":2} and {"b":2,"a":1} are the same JSON by spec (objects are unordered), but this tool will show every line as changed because the underlying parser preserves each document's original property order when it re-serializes for comparison. If you're comparing two snapshots of the same API response and expect them to match but they don't, sort the keys in both first — the JSON Formatter's "Sort keys" option does exactly that — before pasting them in here.
How the line-level diff actually works
Both documents are pretty-printed to a consistent indentation, then compared line by line using a longest-common-subsequence alignment — the same family of algorithm git diff and diff -u use, not a naive index-by-index comparison. The difference matters: a positional comparison flags every single line after an insertion or deletion as "changed," because line 5 in the old document no longer lines up with line 5 in the new one. LCS alignment finds the actual matching lines on both sides first, then only flags the lines that genuinely differ — so adding one new key near the top of a long JSON document doesn't paint the entire rest of the file red.
What "added," "removed," and "changed" mean in the diff grid
A blank cell on one side with content on the other means that line exists in only one document — added if it's on the right, removed if it's on the left. Two different non-blank values on the same row means the line exists in both but the content differs. Because the comparison works on pretty-printed lines rather than parsed key paths, a single property whose value changes shows as one changed line; but a property whose value type changes from a scalar to a nested object will show as a block of new lines, since the JSON for that key now spans multiple lines after formatting.
How to use this tool
- Paste the original JSON in the left panel.
- Paste the modified JSON in the right panel.
- Click Compare.
- Review highlighted differences — added keys, removed keys, and changed values are shown distinctly.
A .NET-specific gotcha: property order isn't guaranteed stable across releases
System.Text.Json serializes object properties in declaration order by default, not alphabetically. That's normally invisible — until someone reorders properties on a DTO during a refactor, or a new field gets inserted in the middle of a class instead of appended at the end. The JSON payload is functionally identical, every value is unchanged, but a diff between the before/after API response will light up as different here. Before concluding an API response actually changed behavior, check whether it's a value difference or just a property-order shuffle from the C# side.
Left JSON
{
"name": "DevToolsHub",
"version": 1
}Right JSON
{
"name": "DevToolsHub",
"version": 2
}Visual JSON diff
JSON diff summary
Summary
Left length: 43, right length: 43