Compare Two JSON Files by Structure (JSON Diff)
Paste two JSON documents or open two files. See added, removed and changed values with their paths, then copy or download the diff report.
Use this tool in your browser without installing software.
About this tool
If a port changes from 8080 to 9090, the path /server/port shows which value changed. Whitespace and object key order do not affect the result. Array order matters by default. You can ignore that order, but duplicate items still count. Copied and downloaded reports include the full path of each difference. Check the original documents for long values.
How to use it
- 1
Paste the first and second JSON into the two boxes, or open a file for each. The list of differences appears as you type.
- 2
Read the path in each row. In the counter and text report, a plus marks an addition, a minus marks a removal, and a tilde (~) marks a change.
- 3
Copy the report or download it as diff.txt. Choose “Reverse” to swap the documents and read the changes in the opposite direction.
If the file will not open
- It says “The first JSON is not valid at line …” but my app reads the file.
JSON is strict and some programs are lenient. Three usual causes: a trailing comma after the last item, single quotes instead of double quotes, and comments. Remove all three and the document is standard.
- The list is empty even though the files look different.
Whitespace, line breaks and object key order are ignored. The numbers 1 and 1.0 also compare as equal. Check the array-order setting and consult the source files if the values are large numeric IDs.
- Two arrays with the same items are full of differences.
If only the positions changed, turn on “Ignore array order”. A value that occurs more often in one array will still be reported as a difference.
Frequently asked questions
Why is moving a key around not a difference?
In JSON the order of keys means nothing; {"a": 1, "b": 2} and {"b": 2, "a": 1} are the same document. The comparison works the same way so the list does not fill up with meaningless noise.
Why do two arrays with the same items show differences?
Array order matters by default. With “Ignore array order” on, [1,2] and [2,1] match, but comparing [1,1] with [1] still shows one removal.
What do paths like /a~1b mean?
They are JSON Pointers: each / goes one level down. Because a slash is the separator, a slash inside a key becomes ~1 and a tilde becomes ~0. So /a~1b is the key a/b, not two levels.
A long value came out shortened; where is the full one?
Each displayed value is limited to 140 UTF-16 code units in the list and 160 in the text report. A long path may not fit on screen, but the copied or downloaded report includes the full path. Use it to find the complete value in the original document.
Is my file or text stored anywhere?
Your browser reads the files and compares them locally. Neither document’s contents are sent to the server.
Why can different large numeric IDs compare as equal?
Some large integers cannot be read exactly as JavaScript numbers. For example, 9007199254740992 and 9007199254740993 can be read as the same number. If the value is an ID, store it as a quoted string in the source document before it is parsed.