JSON Diff
Compare two JSON documents side by side or as a list of paths, such as $.name changed from "John" to "Jane". Key order is ignored; numbers compare exactly. How it works
Use the JSON Diff
Compares as you type. Objects are compared by key (order ignored), arrays by position, numbers by exact value (1.0 equals 1; digits beyond 15 are kept, not rounded). Duplicate keys: the last one wins. Up to 1,000,000 characters per side; larger inputs are compared in the background.
Differences
| Change | Path | A | B |
|---|---|---|---|
| Changed | $.name | "John" | "Jane" |
About the JSON Diff
Comparing {"name":"John","age":30} with {"name":"Jane","age":30} gives 1 difference: $.name changed from "John" to "Jane". Put the old document in A and the new one in B: removed means only in A, added means only in B. This JSON diff compares objects key by key, so key order does not matter, and arrays position by position, so [1,2,3] against [3,2,1] is 2 changes. Numbers are compared by exact value: 1.0 equals 1e0, while 12345678901234567890 and 12345678901234567891 differ. Tick Side by side to see both documents pretty-printed and lined up, with each changed line marked.
Example comparisons and the paths they report
| JSON A | JSON B | Summary | Differences |
|---|---|---|---|
| {"name":"John","age":30} | {"name":"Jane","age":30} | 1 difference: 1 changed. | changed $.name: "John" → "Jane" |
| {"a":1,"b":2} | {"b":2,"a":1} | No differences: the two documents are equal. | (none) |
| [1,2,3] | [3,2,1] | 2 differences: 2 changed. | changed $[0]: 1 → 3; changed $[2]: 3 → 1 |
| {"user":{"tags":["a","b"]}} | {"user":{"tags":["a"],"admin":true}} | 2 differences: 1 added, 1 removed. | removed $.user.tags[1]: "b"; added $.user.admin: true |
| {"my key":1} | {"my key":2} | 1 difference: 1 changed. | changed $["my key"]: 1 → 2 |
| {"a":{"b":1}} | {"a":[1]} | 1 difference: 1 changed. | changed $.a: {"b": 1} → [1] |
| {"x":1.0} | {"x":1e0} | No differences: the two documents are equal. | (none) |
| {"id":12345678901234567890} | {"id":12345678901234567891} | 1 difference: 1 changed. | changed $.id: 12345678901234567890 → 12345678901234567891 |
| {"a":1,"a":2} | {"a":2} | No differences: the two documents are equal. | (none) |
A path starts at $, the whole document: .key for a key, [n] for an array position counted from 0, and ["my key"] for a key that is not a plain name.
Frequently asked questions
- Does JSON diff ignore the order of keys?
- For objects, yes: {"a":1,"b":2} and {"b":2,"a":1} give “No differences: the two documents are equal.” Arrays are different, because their order is part of the data.
- Why are two arrays with the same items reported as different?
- Arrays are compared position by position. [1,2,3] against [3,2,1] reports $[0] changed from 1 to 3 and $[2] from 3 to 1; the middle item matches. There is no option to ignore array order or to match items by an id.
- What happens if one side is not valid JSON?
- The comparison waits and the message names the side, the line and the column. A trailing comma, as in {"a": 1,} written over three lines, gives JSON B is not valid JSON: Unexpected character "}" at line 3, column 1. Comments and unquoted keys are rejected the same way.
- Can it compare very large numbers?
- Yes. Numbers keep all their digits, so 12345678901234567890 and 12345678901234567891 are reported as changed. JavaScript’s JSON.parse would round both to the same value and call them equal.
- What does it do with duplicate keys?
- The last one wins, as in JSON.parse: {"a":1,"a":2} equals {"a":2}.
- How large can the two documents be?
- Up to 1,000,000 characters each, pasted or opened from a .json file. Above 60,000 characters in total the comparison runs in the background. The first 500 differences are listed, the counts cover all of them, and a value longer than 200 characters is cut in the list. The side-by-side view works up to 60,000 characters in total and shows the first 2,000 lines.
Related Tools
View all toolsCSV to JSON
Convert CSV to JSON: the first row becomes the keys, quoted commas and line breaks are kept, and numbers and booleans are detected only if you ask.
JSON to CSV
Turn JSON into CSV: an array of objects, one object or a list of values. Flatten nested objects, expand arrays into rows, then copy or download.
XML to JSON Converter
Convert XML to JSON and JSON back to XML: attributes go under @attributes, repeated elements become arrays, and an XML error shows its line and column.
YAML to JSON Converter
Convert YAML to JSON with anchors and merge keys resolved, YAML 1.2 or 1.1 typing for yes/no, and a warning for numbers JSON cannot hold.
JSON to YAML
Convert JSON to YAML in block or flow style. Text such as yes or 017 is quoted so it stays a string, and a JSON error shows its line and column.
SQL to JSON
Turn SQL INSERT statements, or a result table pasted from psql, MySQL or Markdown, into JSON. Quoted values stay strings; numbers, true and NULL get types.