How to compare two JSON files
- Paste the original JSON into Original, or drop a
.jsonfile on the panel. Open file works too. - Paste the changed version into Changed. Use Load sample to try it first.
- Read the summary: changed, added and removed counts. Step through them with the arrow buttons, or press
F3andShift+F3. - Click a row in the Differences table to jump to it. Copy as JSON Patch gives you the operations that turn the original into the changed file, and Download report saves the list as a Markdown file.
Both sides are shown pretty-printed with 2-space indent, so changed lines line up. Switch to Unified for a single column like a git diff.
How the comparison works
Both documents are parsed first, so spacing and line breaks never matter. The tool then walks the two trees together. Every value has a path, such as $.user.address.city or $.items[2].price, where $ is the root.
- A key only in the second document is added. A key only in the first is removed.
- A value present in both but different is changed, shown as old -> new.
- If a whole object or array is added or removed, it is reported once at its root, not once per leaf.
- If the type changes, for example a string becomes an object, that is one change at that path.
Arrays are compared position by position unless you ignore array order. In that mode equal items are matched like a multiset, and leftover objects are paired up so you still see which field inside them changed.
A worked example
First document:
{
"user": {
"name": "Asha",
"city": "Pune"
},
"tags": ["a", "b"],
"age": 30
}
Second document, which also adds an email key:
{
"user": {
"name": "Asha",
"city": "Leeds",
"email": "a@x.com"
},
"tags": ["a"],
"age": "30"
}
With the default options the differences are:
+ $.user.email: "a@x.com"~ $.user.city: "Pune" -> "Leeds"- $.tags[1]: "b"~ $.age: 30 -> "30"
The same four rows appear in the Differences table, each with its path and the value on both sides.
Tips
- Format messy input first with the JSON formatter, and use the JSON validator to find syntax errors and duplicate keys.
- When two JSON files are supposed to be byte-for-byte alike, the text diff checker shows line-level changes.
- Use Swap to flip the two documents: added and removed trade places.
- Large integers above 9,007,199,254,740,991 lose precision in JSON parsing. Keep IDs like that as strings.
- If a document repeats a key, the last value wins and the tool adds a note.
Your JSON is compared locally and never sent anywhere.