JSON Diff Checker
Compare two JSON documents and list the added, removed and changed paths, ignoring key order. Runs in your browser; nothing is uploaded.
- Added
- 0
- Removed
- 0
- Changed
- 0
| Change | Path | Old value | New value |
|---|
How to use the JSON diff checker
- Paste the original document into the Original JSON box.
- Paste the new version into the Modified JSON box.
- Click Compare. Once both boxes contain text, the result also updates as you type.
- Read the counts in the summary: Added, Removed and Changed.
- The Differences table lists each change with its Change type, its Path, the Old value and the New value.
- Click Copy to copy the list as plain text, one line per change, with
+for an addition,-for a removal and~for a change.
If one box is empty, the tool asks you to fill both. If one box holds invalid JSON, the message names that box (Original JSON or Modified JSON) and gives the line and column of the error. When both documents are identical, the tool says so.
How the documents are compared
The comparison walks both documents together. Objects are compared by their set of keys, so the order of keys never matters: {"a": 1, "b": 2} and {"b": 2, "a": 1} are identical. Arrays are compared by position. The first item of one array is compared with the first item of the other, the second with the second, and so on. Items that exist on only one side are reported as added or removed.
Position matters for arrays, so inserting one item at the start of a list reports every later item as changed. For [1, 2, 3] against [0, 1, 2, 3] the tool reports three changes at $[0], $[1] and $[2], and one addition at $[3]. If you are comparing lists whose order can change, sort them first or compare objects that carry an identifier.
A value whose type differs counts as changed even if it looks similar: the text "1" and the number 1 are different. A null on one side and a missing key on the other are reported as added or removed, because the key itself is not there.
Reading the paths
Paths start with $, the root of the document. A key with a simple name is written with a dot, as in $.user.email. A key with spaces or a dash is written in brackets with quotes, as in $["first-name"]. An array item is written with its index, as in $.users[2].email. Numbers are compared exactly, so large integers that differ only in their last digits are still reported.
The table shortens long values on screen, but the Copy button keeps every value in full.
Frequently asked questions
Why does one inserted item show many changes?
Arrays are compared by index, so an item added at the beginning moves every later item to a new index. Sort the arrays, or compare objects that have a stable id, to see only the real change.
Does the order of keys matter?
No. Keys are matched by name, so two objects with the same keys and values are identical, whatever order the keys are written in.
Why is the string "1" different from the number 1?
JSON keeps the two apart. A string is written in quotes, and a number is not, so the tool reports them as a change of type.
What happens if one side is not valid JSON?
The tool does not compare anything. It names the side that failed, either Original JSON or Modified JSON, and gives the line and column where the parser stopped, so you can fix that side and compare again.
Is it safe to compare private data?
The comparison runs entirely in your browser. The two documents are not uploaded, but very large documents depend on the memory of your device, so split them if the page becomes slow.
Related tools
- Text Diff Checker Compare two texts and see every difference side by side or inline, by line, word or character. Private diff checker that runs in your browser.
- Code Diff Checker Compare two versions of code side by side or inline, with syntax highlighting, line numbers, whitespace options and a unified diff you can copy or download.
- JSON Formatter and Validator Free JSON formatter and validator that beautifies, minifies and checks JSON in your browser, with syntax errors reported by line and column.