๐Ÿ” JSON Diff

JSON A (before)
JSON B (after)
Diff result
Changedage30 โ†’ 31
RemovedcityTokyo
AddedcountryJapan

Enter two JSON values and this tool automatically detects and lists added keys, removed keys, and keys whose value changed. Supports nested objects and arrays. Handy for reviewing config file changes or comparing API responses.

How to use

  1. Enter the original JSON on the left and the JSON to compare against on the right.
  2. Added, removed, and changed keys are detected and listed automatically.
  3. If there's no difference, "No differences" is shown.

How the calculation works

This tool reads two JSON documents and lists which values were added, removed or changed. 1. Each document is flattened into a list of "path โ†’ value". Object keys are joined with "." and array elements with "[index]" (for example user.address.city, items[0].name). 2. Paths found in only one list are "added" or "removed"; paths in both with different values are "changed". 3. Results are sorted by path. Key order, indentation and line breaks are not compared, so documents written differently but with the same content show no differences.

Worked example

Before: {"name": "Alice", "age": 30, "city": "Tokyo"} After: {"name": "Alice", "age": 31, "country": "Japan"} Result age: changed (30 โ†’ 31) city: removed (Tokyo) country: added (Japan) name is unchanged, so it is not listed.

Things to be aware of

  • Arrays are compared index by index. Inserting an element at the front makes every later element show as changed (["a","b","c"] โ†’ ["x","a","b","c"] gives [0]โ€“[2] changed and [3] added).
  • If keys contain ".", paths become hard to tell apart from nested keys.
  • The numbers 1 and 1.0 are the same JSON value and are not reported as a difference.

FAQ

How are arrays with a different element order handled?

Arrays are compared by index position, so the same elements in a different order are detected as "changed".

Does this handle deeply nested objects?

Yes, nested objects are expanded into dot-separated paths (e.g. user.address.city) and compared accurately, no matter how deep the nesting.

What happens if I enter invalid JSON?

An error message appears if either JSON value isn't valid.