Guides · JSON

JSON Diff Online: The Complete Guide

How to compare two JSON objects online, read the diff output, and apply JSON diff in API debugging, config management, and data migration workflows.

Last updated: May 4, 2026

What is JSON diff?

A JSON diff tool compares two JSON documents and produces a structured report of every difference: fields that were added, fields that were removed, and values that changed. Unlike a plain text diff, a JSON-aware diff understands the structure of the data — it compares field by field rather than line by line, which means reformatting one document does not create false positives.

JSON diff is especially useful when comparing API responses across versions, before and after a data migration, or between a local configuration file and a deployed one.

A concrete diff example

JSON A (original)

{
  "id": 1,
  "name": "Alice",
  "role": "admin"
}

JSON B (modified)

{
  "id": 1,
  "name": "Alice",
  "role": "editor",
  "department": "Engineering"
}

Diff output

  id: 1
  name: "Alice"
~ role: "admin" → "editor"
+ department: "Engineering"

How to use JSON Diff online

  1. Paste your original JSON into the JSON A panel.
  2. Paste the modified JSON into the JSON B panel.
  3. The diff updates automatically — no button to click.
  4. Read the color-coded result: green = added, red = removed, yellow = modified.
  5. Use Hide unchanged to focus only on the differences.
  6. Click Swap A / B to reverse the direction of the diff.

4 practical use cases for JSON diff

API response versioning

Compare the response from v1 and v2 of an API endpoint. JSON diff shows exactly which fields were renamed, removed, or restructured — preventing integration surprises.

Config drift detection

Export your local config and your production config as JSON objects and diff them. Quickly see which settings diverged without reading line by line.

Data migration validation

After migrating a database record from one schema to another, diff the before and after to confirm that all fields were preserved or intentionally transformed.

Redux state debugging

Serialize two Redux store snapshots to JSON and diff them to see which slice of state changed after a user action — useful for debugging unexpected re-renders.

JSON diff vs text diff: what is the difference?

A plain text diff (like git diff) compares files line by line. If you reformat a JSON object — changing indentation, reordering keys, or moving a property — a text diff reports every changed line, even though the data is identical.

A structural JSON diff parses both documents into in-memory objects and compares them semantically. Key order and whitespace do not matter — only the actual field values and structure. This eliminates false positives and makes the output much easier to read.

Handling arrays in JSON diff

Arrays are compared element by element at each index. If element 0 in A differs from element 0 in B, it is reported as a modification at path [0]. If B has more elements than A, the extra elements are reported as additions. If A has more elements, they are reported as removals.

Note that array element reordering is treated as modifications unless you sort both arrays before comparing. For sets (arrays where order does not matter), sort them before running the diff to get a cleaner result.

Frequently asked questions

Does JSON diff care about key order?

No. Objects are compared by key name, not by the order in which keys appear. {"a":1,"b":2} and {"b":2,"a":1} are considered identical by the diff.

Can I compare two JSON arrays at the top level?

Yes. Top-level arrays are fully supported. Each element is compared at the same index position.

What happens if the two JSON documents have completely different structures?

All fields in A are reported as removed and all fields in B are reported as added. The summary will show N additions and N removals with 0 modified and 0 unchanged.

Can I use JSON diff to find renamed fields?

Not directly — a rename appears as a removal of the old key and an addition of the new key. There is no semantic concept of "rename" in JSON structure.

Is my data sent to a server when I use JSON Diff?

No. The diff algorithm runs entirely in your browser using JavaScript. Neither JSON document is transmitted anywhere.