JSON diff
Compare two JSON documents and list added, removed and changed JSONPaths with statistics. Arrays can be compared by index or by a key field, and the result can show only differences or everything.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Summary
Please enter JSON text
What this tool does
- When an API response looks wrong, paste the before and after JSON and see line by line which field changed, appeared or disappeared.
- Config migration or version comparison: confirm that nothing outside the intended fields changed between the old and new file.
- Track added and removed array entries: comparing by an id key pinpoints exactly which record was added or deleted instead of being misled by shifted indexes.
- Write release notes or commit messages: copy the diff list straight out as evidence of the interface change.
Example
Input
Left {"name":"UniKit","version":1,"list":[{"id":1,"title":"A"},{"id":2,"title":"B"}],"debug":true}
Right {"name":"UniKit","version":2,"list":[{"id":1,"title":"A"},{"id":3,"title":"C"}],"extra":null}Output
Unchanged $.name "UniKit"
Changed $.version 1 → 2
Unchanged $.list[0] {"id":1,"title":"A"}
Changed $.list[1].id 2 → 3
Changed $.list[1].title "B" → "C"
Removed $.debug true
Added $.extra null
Summary: 1 added · 1 removed · 3 changed · 2 unchangedThis example compares arrays by index. Switch the array comparison to "by key field" and the list becomes $.list[id=1] unchanged, $.list[id=2] removed, $.list[id=3] added, free of index-shift noise.
Frequently asked questions
What is the difference between comparing arrays by index and by key?
By index compares position by position, so inserting one item in the middle marks everything after it as changed. By key it pairs elements using the value of a chosen field and correctly identifies which record was added or removed. When array items are objects with a unique field, prefer key mode; the field name is configurable and defaults to id.
Does a different key order count as a difference?
No. The comparison is structural: objects are matched by key name regardless of order, and only array order matters. So {"a":1,"b":2} and {"b":2,"a":1} are reported as identical.
What happens if one side is not valid JSON?
The tool tells you which side failed and gives the line, column and reason — unexpected end of input, unterminated string, extra content after the JSON value and so on. It never guesses what you meant, so just fix the syntax and paste again.
What format does the diff use?
Each line is "type path value", with JSONPath-style paths such as $.list[0].name (non-identifier keys become $["a-b"]) and changes shown as "old → new". Switching to "everything" also lists unchanged fields, which is handy for confirming what did stay the same.
Are the two documents uploaded?
No. Parsing, comparison and rendering all happen in your browser, no network request is made and it works offline. API payloads and config contents are never recorded.
Keywords:jsonjson 对比json diff比较 jsoncompare json差异json 比较array diff