Compare JSON API Responses to Debug Changes

Guide · August 24, 2026

When an API behavior changes, the fastest way to find out what happened is to compare the old response against the new one. But JSON is structured data — a plain text diff will flag every reformatted line, even if the values are the same. You need a diff that understands JSON structure.

DiffLab's JSON Compare tool parses both inputs as JSON objects and compares them field by field. Added fields are highlighted in green, removed fields in red, and modified values in orange — regardless of key ordering or whitespace.

Step-by-step: comparing two API responses

Imagine your API previously returned this user object:

{
  "id": 42,
  "name": "Alice",
  "email": "alice@example.com",
  "role": "member",
  "active": true
}

After a recent deploy, the response now looks like this:

{
  "id": 42,
  "name": "Alice",
  "email": "alice@newdomain.com",
  "role": "admin",
  "active": true,
  "createdAt": "2026-01-15T00:00:00Z"
}

Paste both into the JSON Compare tool. DiffLab highlights:

Fields like id, name, and active are unhighlighted because they did not change. This is far more useful than a line diff, which would flag every line as "changed" if the JSON was reformatted.

Tree view vs text view

DiffLab's JSON Compare offers two visualization modes:

Common debugging scenarios

Detecting a breaking API change

Capture the response from your staging environment and from production. Paste them in. If a field was renamed or removed, it appears as a red deletion and a green addition — signaling a potential breaking change for clients that depend on that field.

Verifying a data migration

Export a sample record from the old database and the corresponding record from the new database as JSON. Compare them. Any field that changed during migration is highlighted, so you can verify the migration did not corrupt data.

Regression testing

Save a known-good API response as a JSON file. After a code change, hit the same endpoint and compare the new response against the saved one. Any unexpected field change is immediately visible.

Note: JSON Compare requires both inputs to be valid JSON. If one side is invalid, the tool will show a parse error. If your API returns JSON wrapped in JSONP or includes non-JSON text, extract the JSON payload first. Minified JSON is fine — the tool auto-formats it.
Note: Array order matters. If your API returns [1, 2, 3] and later returns [3, 2, 1], every element will appear as modified because the diff compares by position, not by value. For unordered comparison of array elements, consider using the List Compare tool instead.

For a deeper comparison of when to use JSON diff versus plain text diff, see JSON Diff vs Text Diff: When to Use Which.

Compare your JSON API responses now.

Open JSON Compare