JSON Diff Tool
Compare two JSON files or strings. Highlight added, removed, modified keys. Visualize differences.
What is a JSON diff tool?
A JSON diff tool compares two JSON documents by structure rather than by text, and lists which keys were added, removed or changed. Paste the original JSON on the left and the new version on the right, and MavexTech’s JSON Diff shows a count of each kind of change plus the exact dot-notation path of every difference, such as user.address.city. Because it compares parsed data, differences in spacing, indentation and key order are ignored — only real data changes are reported.
How to compare two JSON files
- Paste the original into JSON A — for example yesterday’s API response or the old config file.
- Paste the new version into JSON B.
- Click Compare. Three counters show how many keys were Added, Removed and Modified.
- Read the change list — green
+lines are new keys with their value, red-lines are keys that disappeared, and amber~lines show the old and new value side by side. - If you see JSON Parse Error, one side is not valid JSON; tidy it with the JSON Formatter first.
How the comparison works
Both inputs are parsed with JSON.parse. The tool then walks every key of object A and object B:
- A key present in A but not in B is removed; a key in B but not in A is added.
- If a key exists in both and the values serialise differently, and both values are plain objects, the tool goes one level deeper and repeats the check, building paths like
user.address.pin. - Otherwise the key is modified, and the old and new values are printed.
Arrays that sit inside an object are compared as a whole: any difference in length, order or content marks the whole array as one modification. Values are compared strictly, so the number 10 and the string "10" are different, and so are true and "true".
What the tool reports (checked on the live tool)
| JSON A | JSON B | Result |
|---|---|---|
| Default sample (age 30, city Mumbai, 2 skills) | Default sample (age 31, city Bangalore, 3 skills, country India) | Added 1 (country = "India"), Removed 0, Modified 3 (age, city, skills) |
{"a":1,"b":2} | {"b":2,"a":1} | 0 / 0 / 0 — key order does not matter |
{"price":10} | {"price":"10"} | Modified 1: price 10 to "10" (type change) |
{"tags":["a","b"]} | {"tags":["b","a"]} | Modified 1: tags (array order matters) |
{"a":{"x":1}} | {"a":null} | Modified 1: a {"x":1} to null |
[1,2,3] | [1,2,4,5] | Added 1 (3 = 5), Modified 1 (2: 3 to 4) — top-level arrays are compared by index |
Worked example: a nested API response
JSON A:
{"user":{"id":7,"name":"Asha","address":{"city":"Pune","pin":"411001"}},
"tags":["a","b"],"active":true}JSON B:
{"user":{"id":7,"name":"Asha","address":{"city":"Mumbai","pin":"400001"},"phone":null},
"tags":["b","a"]}Result: Added 1 — user.phone = null; Removed 1 — active; Modified 3 — user.address.city ("Pune" to "Mumbai"), user.address.pin ("411001" to "400001") and tags (["a","b"] to ["b","a"]). The unchanged user.id and user.name are not listed, which keeps the report short even for large objects.
Where a JSON diff helps
- API regression checks — compare a response before and after a deploy to catch renamed or missing fields.
- Configuration reviews — spot what really changed in
package.json, feature-flag files or app settings, ignoring re-indentation. - Test snapshots — understand why a snapshot test failed without scrolling through a text diff.
- Data migration — confirm that a record exported from the old system matches the new one.
- Webhook debugging — compare the payload you expected with the one you actually received.
Tips
- When an array of objects is flagged as modified, copy the two arrays into the Text Diff Checker after formatting them, to see which element changed.
- To compare the elements of an array one by one, paste just the two arrays as the top-level JSON: top-level arrays are compared index by index.
- Remove volatile fields such as timestamps or request IDs before comparing, so they do not hide the changes you care about.
- Keys are case-sensitive:
"Name"and"name"are two different keys, which is a common cause of “missing” data between systems.
Limitations & notes
Arrays inside objects are not diffed element by element, so a single new item in a long list shows as one modification of the whole list. Removed keys are listed by path without their old value. Both inputs must be strict JSON: comments, trailing commas, single quotes and unquoted keys cause a parse error. Very large documents (several megabytes) are processed in your browser’s memory and may be slow; command-line tools such as jq are better for those. Everything runs locally — no JSON is uploaded.
Frequently asked questions
Does key order affect the comparison?
No. Objects are compared key by key, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical with zero changes.
How are arrays compared?
An array inside an object is compared as a whole, so any change in length, order or content marks it as one modification. If the two top-level values are arrays, they are compared index by index.
Are keys case-sensitive?
Yes. "Name" and "name" are different keys, so renaming one to the other shows as one key removed and one key added.
Does it detect type changes such as 10 versus "10"?
Yes. Values are compared after parsing, so a number that became a string, or true that became "true", is reported as modified.
Why do I get a JSON Parse Error?
One of the inputs is not strict JSON. Common causes are trailing commas, single quotes, comments or unquoted keys. Fix the input or run it through a JSON formatter first.
Is there a size limit?
There is no fixed limit, but the comparison runs in your browser, so files of many megabytes can make the page slow. Split large files or use a command-line tool for them.
Is my JSON sent to a server?
No. Parsing and comparison happen entirely in your browser, so API keys or customer data in the JSON stay on your device.
Related tools
JSON Formatter · Text Diff Checker · JSON to CSV · CSV to JSON · YAML Validator
