API Response Diff Checker — Compare JSON Online Free

⚙️ Developer Tools Free Forever

API Response Diff Checker

Paste two JSON API responses and get a clean, highlighted diff. Instantly see what changed, what was added, and what was removed.

Response A
Response B
Paste two JSON responses above and click Compare.
All processing happens in your browser. No data is sent to any server.
About This Tool

How this API JSON diff tool compares two responses key by key, not line by line

Most text diff tools compare JSON the way they compare any file: line against line. That breaks the moment a key gets reordered or a formatter reindents the file, because two functionally identical payloads suddenly look completely different. This tool skips that problem entirely. It parses both inputs as real JSON, flattens each one into a flat map of dotted paths, and compares those paths directly, so reordering keys or changing whitespace never produces a false difference.

Everything happens in your browser using JSON.parse and plain JavaScript object walks. There is no fetch, no XHR, and no server call anywhere in the script. Nothing you paste into either box leaves the tab.

The flatten and compare algorithm

Before any comparison happens, both responses go through the same flattening pass, turning nested structures into single level key paths that are easy to line up.

Step 1 Recursive flatten Every object key becomes a dotted path segment, and every array index becomes a bracketed segment, so data.tags[2] is a real, comparable key rather than a nested structure.
Step 2 Union of keys The tool builds one combined, alphabetically sorted list of every path found in either response. This is what makes an added field in response B and a removed field in response A both show up correctly, even if the two payloads have completely different shapes.
Step 3 Value comparison For each shared path, both values are serialized with JSON.stringify and compared as strings. That catches type differences too, since "42" and 42 stringify differently and are correctly flagged as changed.
Step 4 Classification Each path is labeled same, added, removed, or changed, and the counts feed the summary stats above the diff output.
// simplified from the tool’s diffObjects function function flattenObj(obj, prefix, out) { if (Array.isArray(obj)) { obj.forEach(function(v, i) { flattenObj(v, prefix + ‘[‘ + i + ‘]’, out); }); return out; } Object.keys(obj).forEach(function(key) { flattenObj(obj[key], prefix + ‘.’ + key, out); }); return out; }

Because comparison runs on flattened paths instead of raw structure, a field that moves from position three to position one in an object produces zero diff noise. Only paths whose actual value changed, appeared, or disappeared get flagged.

Two ways to read the output

The result renders in one of two layouts, both built from the same diff array so switching between them never reruns the comparison.

ModeLayoutBest for
InlineSingle column, unified diff style with + and – markers on separate linesScanning a long response top to bottom
Side by sideTwo columns, response A on the left and response B on the rightComparing structurally similar payloads field by field
Array order matters here. Because array items are indexed by position, not by content, reordering an array (say, swapping the first two tags in a list) shows up as a changed value at each shifted index rather than as a genuine content change. If you are diffing arrays where order is not meaningful, sort them before pasting.

What each mode gives you

Format button

Runs both textareas through JSON.stringify(value, null, 2), pretty-printing minified API responses into readable two-space indented JSON before you even compare.

Download diff

Exports a plain-text file in a familiar unified diff header format, with a --- Response A and +++ Response B preamble, so it can be pasted into a bug report or pull request comment.

Swap and clear

Swap exchanges the contents of the two boxes instantly, useful for checking whether the diff reads the same in reverse. Clear resets both panes and the stat counters together.

Error handling before comparison

Each box is validated independently with its own try and catch around JSON.parse. If either side fails to parse, the tool reports the specific parse error message for that box and stops before running any comparison, rather than guessing at partial output.

Client-side JSON.parse only Dot and bracket path notation Alphabetical key ordering

Related standards and tools

  • RFC 8259 defines the JSON data interchange format this tool parses and re-serializes.
  • RFC 6902 JSON Patch defines a formal operation-based diff format (add, remove, replace) for JSON documents, useful if you need a machine-applicable patch rather than a human-readable report.
  • RFC 7396 JSON Merge Patch describes a simpler merge-based alternative for describing changes to a JSON document.
  • deep-diff is a Node library that performs a similar structural walk for programmatic use in test suites.
  • JSONLint is worth bookmarking separately for validating malformed JSON before diffing it here.

When you actually need a structural diff

Comparing an API response before and after a backend deploy to catch unintended field changes, checking that a webhook payload matches its documented schema, reviewing what changed between two versions of a configuration object, verifying that a database migration did not silently drop a field, and debugging why two environments (staging versus production) return subtly different data for the same request.

Common Questions

FAQ: API Response Diff Checker

Any valid JSON — objects, arrays, nested structures, mixed types. The differ flattens nested keys into dot-notation paths so every value at every level gets compared.

No. All parsing and comparison runs entirely in your browser. No data leaves your machine, which makes it safe to use with production API responses containing sensitive payloads.

Green lines with a + were added in Response B. Red lines with a – exist in A but not B. Yellow lines with ~ had their value changed. Gray lines are identical in both responses.

Yes. Click Format JSON first and the tool pretty-prints both sides before comparing. This makes the diff much easier to read and removes false positives from whitespace differences.

Make the same API call against both environments (for example, staging and production), copy the JSON body from each response, paste them into Response A and B, and hit Compare. You will see every key that differs instantly.

Privacy Overview

Cookies let this site remember your preferences and show us which tools people actually use. Full detail sits in our Privacy Policy.