What is JSON Diff & Compare?
This JSON diff tool lets you compare two JSON objects, or two whole documents, and lists every difference with its exact path. Paste the original JSON on the left and the modified JSON on the right, and each change is shown as added, removed or changed, with a path such as settings.theme or items[2].price and the old and new values.
Unlike a plain text diff, the comparison works on the parsed data rather than on lines, so differences in indentation, line breaks or key order do not show up as changes. Nested objects and arrays are compared all the way down, which makes it ideal for comparing API responses, configuration files and test fixtures.
How to use JSON Diff & Compare
- Paste the original JSON into the Original JSON box.
- Paste the changed JSON into the Modified JSON box.
- Read the list of differences: each one shows its path, whether it was added, removed or changed, and the values.
- Turn on Ignore array order if the order of list items does not matter, such as for tags or permissions.
Key features
- Deep comparison of nested objects and arrays
- Full path for every change, such as items[2].price
- Array items aligned so an insertion does not cascade
- Optional ignore-array-order mode
- Ignores formatting, whitespace and key order
- Runs in your browser; payloads are not uploaded
Common use cases
- Comparing API responses between two versions or environments
- Reviewing changes to JSON configuration and feature-flag files
- Checking what a migration or script changed in a JSON document
- Verifying snapshot and fixture changes in tests
- Spotting breaking changes in a JSON payload contract
Technical details & standards
Both inputs are parsed with JSON.parse and compared recursively. Objects are compared key by key, so key order never matters: a key present only in the modified JSON is added, a key only in the original is removed, and values that differ are changed. A value whose type changes, such as the string "1" becoming the number 1, is reported as changed.
Arrays are aligned with the same diff algorithm used by git diff, so inserting an item at the start of a list is reported as one added item rather than as every later item changing. Items that were replaced are compared in depth, so a changed field inside an object in a list is reported with its own path, such as users[3].email. With Ignore array order, items are matched by value regardless of position, and only unmatched items are reported.
Compare two JSON files on the command line
This tool compares JSON you paste into its two panels. To compare JSON files in a script, sort the keys first so the order does not show up as a difference.
jq + diff
diff <(jq -S . a.json) <(jq -S . b.json)
# 5c5
# < 2
# ---
# > 3jq -S sorts keys and re-indents both files, so diff reports only real changes; it exits with 1 when the files differ.
Python
import json
with open("a.json") as f: a = json.load(f)
with open("b.json") as f: b = json.load(f)
a == b # True only if every value matches; key order is ignoredCompare two JSON API responses
Compare a saved response with a new response after an API change. A structural diff distinguishes changed values from changes in whitespace or object key order.
Example input
Before: {"user":{"id":42,"plan":"free"}}
After: {"user":{"plan":"pro","id":42}}- Paste the original response into the left input and the updated response into the right input.
- Review the changed plan value from free to pro. Moving the id key within the object is not a value change.
- Inspect added and removed fields separately from changed values. Array order can carry meaning, so check the array comparison options before treating reordered items as equivalent.
Continue with a related task:
Frequently asked questions
How do I compare two JSON objects online?
Paste the first object into Original JSON and the second into Modified JSON. Every added, removed or changed value is listed with its path, such as user.address.city; if the two objects hold the same data, the tool reports No differences, even when their formatting or key order differs.
Does key order matter when comparing JSON?
No. JSON objects are unordered, and the comparison uses parsed values, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical.
How are nested objects compared?
Recursively. The tool walks into every nested object and array and reports each difference at the deepest level where it occurs, with a path such as config.database.port, instead of marking the whole parent as changed.
Can I compare JSON arrays?
Yes. Arrays are aligned like lines in a text diff, so an inserted or removed item is reported once at its index instead of shifting every later item. If order does not matter, turn on Ignore array order to match items by value.
What is the difference between JSON Diff and a text diff?
A text diff compares lines, so reformatting or reordering keys creates noise. JSON Diff parses both documents and compares values, so only real data changes are reported.
How do I compare 2 JSON files?
Open each file in a text editor, copy its contents and paste one into each panel; the differences appear with their paths, such as users[0].email. Key order and formatting are ignored, and Ignore array order treats [1, 2] and [2, 1] as equal. For files in a repository or CI job, use the jq command above.
Is my data safe?
Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.
Does it work offline?
Once the page has loaded, this tool can process input without an internet connection.