JSON Compare
Paste two JSON documents to see exactly what changed. No settings needed: hints tell you when another way of comparing would help.
Three steps
- Paste the original JSON on the left.
- Paste the changed JSON on the right.
- The differences appear here by themselves.
How to use it
Paste two documents
Original on the left, changed version on the right. Paste, type, or drop a .json file on either side. There is no Compare button: the result updates as you type.
Read the list
Each row is one difference: what happened (added, removed, changed) and where. Click a row to see it in place in the side-by-side view.
Follow the hints
When items only changed place, or a time stamp gets in the way, a blue hint offers a better way to compare. One click applies it, one click takes it back.
Reading the result
New to this? Here is what each word on the screen means.
- What does comparing JSON mean?
JSON is a common format for passing data between programs. It looks like {"name":"Ann","age":30}. Comparing means finding what differs between two such documents: an API response before and after a release, or the settings of two environments.
This tool compares the data, not the text. Spaces, line breaks and the order of the fields never count as differences.
- How to read a path
Every difference starts with something like $.users[0].email. That is the address of the value:
- $ is the whole document
- .users is the field named users
- [0] is the first item of a list (counting starts at 0)
- .email is the email field of that item
Together: “the email of the first item in users”.
- Added, removed, changed
- Added (green): it is on the right but not on the left.
- Removed (red): it is on the left but not on the right.
- Changed (yellow): it is on both sides with a different value, shown as old → new.
- Moved
An item of a list is in a different place, but it is the same item. This only appears when lists are compared “By field”.
- Type changed
The kind of value changed, for example the number 1 became the text "1" in quotes. They look alike, but programs treat them differently, and this is a common cause of bugs. That is why it gets its own label.
Next to each value is the name of its type, in the words JSON and most programming languages use:
- string: text in quotes, "hello"
- number: 42 or 3.14
- boolean: true or false
- null: no value
- object: fields in braces, {"a":1}
- array: a list in square brackets, [1,2,3]
- What are the blue hints?
They appear when another way of comparing would explain many differences: a list that was only reordered, numbers that are only written differently (1 and 1.0), or a field that changes every time (a time, an ID).
Press the button on the hint to apply it; a message offers to undo it right away. A small tag then shows what is in use; press × on it to go back. You can also ignore the hints: the default is the strictest comparison and never hides a difference.
- Many rows that say the same?
When the same field changed in many items (the price of 100 products), the rows are folded into one, shown as a small stack with one example. Press “Show all” on the right to see each item.
- An input box turned red?
That side is not valid JSON. The line under it says which line and what is wrong. The comparison starts once you have fixed it, so the data you go on to use is known to be correct.
- Handy to know
- Colored line numbers in the input boxes show where the differences are in what you pasted: red removed, green added, yellow changed.
- JSON on one long line? Press “Format” above that side to lay it out. The result does not change.
- Click a path in the list to see it in the side-by-side view. There, J and K jump to the next and previous difference.
- A big document may take a moment; “Comparing…” shows that it is working. You can keep typing.
- Options are remembered in this browser for next time (never what you paste). The tags above the result always show which ones are on.
Questions
Is my JSON uploaded?
No. Both documents are compared in your browser. The page sends nothing you paste to any server.
- There is no “save online” or share link, so your data cannot end up on a public URL by accident.
- What you paste is not stored, not even in your browser. Only the comparison options (such as fields to ignore) are remembered, in your browser.
- You can disconnect from the internet after the page loads and it keeps working.
Does key order or whitespace count as a difference?
No. {"a":1,"b":2} and {"b":2,"a":1} hold the same data, so they count as equal, however they are indented. If the data is the same but the text is not, the page tells you.
How are arrays (lists) compared?
By default item by item, in order, because order is part of an array in JSON. Added and removed items are recognised: one item added at the top shows as one added item, and the items after it do not all show as changed. When something inside an item changed, the list shows where, for example $.items[3].price.
Under “Options” there are two other ways:
- By field: items with the same value in a field such as "id" count as the same item, wherever they are in the list. An item that changed place shows as moved, together with any edits inside it. The page suggests fields from your documents, and you can type any other.
- Any order: the order of items does not count at all. This suits lists such as tags or permissions.
When some differences look like items that only changed place, a hint suggests the option that would explain them.
How do I ignore time stamps and other fields that always change?
When a changed field looks like a time or an ID, a hint asks whether to ignore it. You can also list fields yourself under “Options”, one per line:
- updatedAt: every field with that name, anywhere
- meta.requestId: requestId inside any meta
- $.items[*].updatedAt: only in that place; [*] means every item of the list
Ignored fields are skipped on both sides, and a tag above the result shows what is being ignored.
Are 1 and 1.0 the same?
Not by default. Numbers are compared exactly as written, so no difference is missed. When some differences are only in how a number is written, the page tells you how many and offers “Compare numbers by value”, which treats 1, 1.0 and 1e0 as the same.
Either way, long numbers are never rounded: 12345678901234567890 and 12345678901234567891 always count as different. Tools that read JSON with JavaScript’s built-in JSON.parse round such numbers and may call them equal. "1" in quotes is text, not a number, so comparing it with 1 shows “Type changed”.
What if one of the documents has an error?
It is compared once you fix it. The box turns red, the line is marked and the message says what is wrong, for example a comma before } or single quotes instead of double quotes.
The page does not fix it for you. If a tool quietly fixed your JSON and then said “no differences”, you might keep using a file that other programs cannot read. When JSON Formatter can fix the mistake, a link to it appears next to the error, and it shows you every change it makes.
How large can the documents be?
Documents of several megabytes work. Every difference is found (repeated ones are grouped). The list shows the first 1,000, and “Copy list” gives you all of them. When two documents differ in thousands of lines, the side-by-side view is turned off and only the list remains.