Online Diff
← Blog

How to Compare Two API Responses Online

Spot breaking changes, missing fields, and value differences between two API responses — privately, in your browser.

·5 min read

You hit an API endpoint, get back a JSON payload, and something looks different from yesterday. Maybe a field is missing, maybe a value changed, maybe the structure shifted. Staring at two blobs of minified JSON in separate terminal tabs is a losing game. You need a side-by-side diff.

When You Need to Compare API Responses

This comes up constantly in day-to-day development:

  • Staging vs production — you deployed a change and want to verify the response matches what you tested. Copy both responses and diff them to confirm nothing unexpected changed.
  • Before and after a refactor — you rewrote a service and need to prove the output is identical. A character-level diff catches even trailing whitespace differences.
  • Debugging a broken client — the frontend is rendering wrong data. Diff the expected payload against what the API actually returns. The mismatch is usually one changed key or a null where a value used to be.
  • Third-party API versioning — a vendor releases v2 of their API. Diff a v1 response against v2 to see every field that was added, renamed, or removed before updating your integration.
  • Contract testing — compare the API response against a stored snapshot to catch schema drift. This is what tools like Pact do, but sometimes you just need a quick visual check.

How to Compare API Responses: Step by Step

  1. Copy the first API response. From curl, Postman, browser DevTools (Network tab → Response), or your API client of choice.
  2. Paste it into the Original pane on Online Diff.
  3. Copy the second response — from a different environment, a different time, or a different API version.
  4. Paste it into the Modified pane.
  5. The diff runs immediately. Changed values highlight inline. Added fields are green, removed fields are red.

If your responses are minified, use the Format button to prettify both sides before comparing. This makes the diff much easier to read since each key-value pair gets its own line.

Use the JSON View for Structured Comparison

When both inputs are valid JSON, Online Diff automatically enables the JSON view mode in the toolbar. This gives you a structured, key-by-key comparison instead of a raw text diff.

The JSON view is especially useful for API responses because:

  • Nested objects are compared recursively — a change three levels deep in a data.user.preferences object is surfaced clearly, not buried in a wall of text.
  • Array ordering matters— if items shifted position in an array, you'll see it. This catches pagination changes or sort-order bugs.
  • Minified vs prettified doesn't matter — the structured view compares parsed objects, not raw strings. Whitespace differences are ignored.

Tips for Better API Response Diffs

Prettify first, then diff

Minified JSON is hard to diff because the entire payload is one line. Use the Format button or pipe through jq . before pasting. A prettified response lets the diff engine compare line by line, showing exactly which field changed.

Use character-level diff for subtle changes

Switch to Char diff mode in the toolbar. This highlights the exact characters that changed within a value — useful for catching "v1.4.2" vs "v1.4.3" or a timestamp that shifted by one second.

Strip volatile fields before comparing

Fields like timestamp, requestId, and traceIdchange on every request. They'll dominate the diff output and hide the real changes. Remove them from both payloads before comparing, or use jq to exclude them:

curl https://api.example.com/users/1 | jq 'del(.timestamp, .requestId)'

Compare headers separately

Response headers (content-type, cache-control, rate-limit counters) can reveal issues that the body won't. Copy headers from DevTools into a separate diff if you suspect a header-level change.

Privacy: API Responses Stay in Your Browser

API responses routinely contain auth tokens, session IDs, user data, and internal URLs. Pasting these into a server-side diff tool means your credentials are now on someone else's server.

Online Diff runs the entire comparison in JavaScript in your browser tab. Nothing is transmitted, nothing is logged, nothing is stored. Close the tab and the data is gone. If you need to share the diff with a teammate, use the Share button — it scans for PII first and offers to redact sensitive fields or encrypt the link with a password.

Try the JSON Diff Tool

Paste two API responses and see exactly what changed — structured key-by-key comparison, in your browser.

Open Online Diff →

Related Guides