jsondecode.com logo

JSON Diff

Compare two JSON objects and see exactly what changed. Runs entirely in your browser.

How JSON Diff works

This tool flattens both JSON objects into a list of dot-notation key paths and their scalar values — for example, a nested path like user.address.city — then compares every path across the two inputs.

Keys present in A but not B are removed. Keys present in B but not A are added. Keys present in both but with different values are changed. Both inputs are validated as JSON before comparison.

When to use JSON diff

  • API response changes — compare the JSON output before and after a code change to catch unintended regressions in field names, types, or nesting.
  • Configuration auditing — diff two environment config files to see exactly which settings differ between staging and production.
  • Schema migration — compare a JSON document before and after a data migration to verify transformations were applied correctly.
  • Debugging webhook payloads — compare two event payloads to identify which fields changed between invocations.
  • Test fixture verification — compare expected vs actual JSON in tests to see exactly which fields differ.

Diff JSON from the command line

jq (diff keys)diff <(jq -S . a.json) <(jq -S . b.json)
Pythonpython3 -c "import json,sys; a=json.load(open(sys.argv[1])); b=json.load(open(sys.argv[2])); print(set(a)-set(b), set(b)-set(a))" a.json b.json
Node.js (deepEqual)node -e "const a=require('./a.json'),b=require('./b.json'); console.log(JSON.stringify(a)===JSON.stringify(b))"
Git (JSON-aware)git diff --word-diff a.json b.json

Frequently asked questions

Does JSON diff care about key order?

No. JSON objects are unordered by specification — {"a":1,"b":2} and {"b":2,"a":1} are semantically equal. This tool compares values by key path, not by position, so reordering keys does not show as a change.

How does array comparison work?

Array elements are compared by their index. If element 0 changes, it shows as a changed value at path arr[0]. If an element is inserted at the start, all subsequent indices appear changed. This is the standard flat-diff approach — for semantic array diffing (matching by ID field), consider a dedicated library like deep-diff.

Can I diff large JSON files?

Yes. The comparison runs entirely in your browser with no file size limit imposed by the tool itself. Performance depends on your device — files up to a few megabytes work without issue. Very large files (10MB+) may cause noticeable delay.

What is the difference between JSON diff and JSON patch?

JSON diff compares two documents and shows the differences as a human-readable report. JSON Patch (RFC 6902) is a standard format for expressing the changes as a sequence of operations (add, remove, replace, move, copy, test) that can be applied to transform document A into document B programmatically.

How do I compare two JSON files in VS Code?

Open the first file, then run the command Select for Compare (right-click in Explorer or use the command palette). Then right-click the second file and choose Compare with Selected. VS Code highlights character-level differences inline. For key-path level diffing, this tool gives a cleaner summary.

If jsondecode.com saved you time, share it with your team

Free forever. No ads. No sign-up. Help other developers find it.