JSON Compare
Paste two JSON documents to see what was added, removed or changed, as a list by path or as a JSON Patch. The comparison runs entirely in your browser, so your data is never uploaded.
Paste text, or drop a file here
Paste text, or drop a file here
Example
First
{ "name": "api", "replicas": 3, "ports": [8080], "debug": true }Second
{ "replicas": 5, "name": "api", "ports": [8080, 8443], "region": "eu" }Differences
4 difference(s): 2 added, 1 removed, 1 changed
~ $.replicas: 3 → 5
+ $.ports[1]: 8443
- $.debug: true
+ $.region: "eu"How it handles tricky cases
Key order doesn't matter
JSON objects are unordered, so the same keys in a different order count as equal. A plain text diff would flag those lines.
Array order does matter
Arrays are compared position by position unless you match them by a key or turn on the option to ignore order.
Matching arrays by ID
Enter a key such as id and arrays of objects are paired by that value, wherever each item sits. One new record at the start of a list then shows as one addition, not a change to every row. If items lack the key or repeat it, a note says so and that array is compared without it.
JSON Patch output
Choose JSON Patch to get RFC 6902 operations that turn the first document into the second. When arrays are matched by key or order is ignored, the patch adds new items at the end and doesn't reorder existing ones.
Equal values, different text
1 and 1.0 are the same number, so they count as equal. The number 1 and the string "1" are different.
Reading the result
Each line starts with + for added, - for removed or ~ for changed, followed by a path such as $.ports[1], or $.users[id=7] when arrays are matched by key.
Do it from code
Command line with jq:
diff <(jq -S . a.json) <(jq -S . b.json)
Questions
Can I apply the differences to my file?
Yes. Switch the output to JSON Patch and download it, then apply it with any RFC 6902 library.
Does formatting affect the result?
No. Both documents are parsed first, so whitespace and indentation are ignored.
Which document is the original?
The first box is treated as the original, so something only in the second box is listed as added.
Is my data uploaded?
No. Both documents stay on your device.