How to compare two JSON documents
- Paste both documents into the left panel, either as one object with two keys,
{"left": ..., "right": ...}, or as the first document, a line containing only---, then the second. - The diff appears on the right as you type. The toast shows Identical or the number of differences.
- Tick Ignore array order when arrays are really sets (tags, permissions) and reordering should not count.
- Click Copy or Download .txt to paste the report into a ticket or pull request.
Either side can be any JSON value. If one fails to parse, the error bar says why; click Fix to repair it.
What the output looks like
Input:
{
"left": {"id": 7, "name": "Widget", "price": 9.5, "tags": ["new", "sale"], "stock": 12},
"right": {"id": 7, "name": "Widget Pro", "price": 10, "tags": ["sale", "new"], "sku": "W-7"}
}
Output:
4 changed, 1 added, 1 removed
~ $.name: "Widget" -> "Widget Pro"
~ $.price: 9.5 -> 10
~ $.tags[0]: "new" -> "sale"
~ $.tags[1]: "sale" -> "new"
- $.stock: 12
+ $.sku: "W-7"
The first line is the summary. Each line after it is one difference: ~ for a changed value, + for a key or element only on the right, - for one only on the left. Paths are JSONPath, so $.tags[0] is the first element of the top-level tags array. Values over 80 characters are shortened with ....
With Ignore array order ticked, the two tags lines disappear and the summary becomes 2 changed, 1 added, 1 removed.
What counts as a difference
- Key order never does:
{"a": 1, "b": 2}and{"b": 2, "a": 1}are identical. - Whitespace and indentation never do, because both sides are parsed first.
- Type changes do, and the line says so:
~ $.id: "7" -> 7 (string -> number). nullversus a missing key does; see JSON null vs undefined.- Without the option, arrays are compared by position, so inserting an element at the front reports every later one as changed.
Limits and notes
- Files up to 5 MB for both sides together. Everything runs as JavaScript in your browser; nothing is uploaded.
- The report is for reading, not for applying. For a machine-readable format, see JSON Patch and JSON Merge Patch.
- There is no "moved" marker; a moved element shows as a change, or as a removal plus an addition with the option on.
- Numbers are compared after parsing, so
1.0and1are equal, and integers above 2^53 may lose precision first. - For command-line and scripted approaches, see how to compare two JSON files.