"category": "inspect-and-test",

JSON Compare - Semantic Diff

"tldr": Paste two JSON documents and see only real differences - key order and formatting ignored, changes listed by path with type mismatches flagged.

Compare two JSON documents and see only the differences that matter. Unlike a text diff, this comparison is structural: key order and formatting are ignored, and every real difference is listed by its exact path - values that were added, removed, changed, or silently switched type.

{"diff": "semantic"}
Original (left)
Modified (right)
Differences appear here - paste JSON on both sides

Type changes get their own category because they are the differences text diffs hide best: "10" (string) versus 10 (number) looks identical in a line-by-line view but breaks strongly typed consumers. This is the comparison you want for API response regression checks, config drift between environments, and reviewing what a deploy actually changed.

How to compare two JSON documents

  1. 1Paste the original JSON on the left and the modified JSON on the right.
  2. 2Differences compute live: each row shows the JSONPath, the kind of change, and both values.
  3. 3Key order and whitespace are ignored - only semantic differences are reported.
  4. 4Copy the difference report, or use Swap to reverse the comparison direction.

Convert JSON A to JSON B in code

JavaScript (deep-diff)
import { diff } from "deep-diff"; // npm install deep-diff

const differences = diff(originalObj, modifiedObj) ?? [];
differences.forEach(d => console.log(d.kind, d.path?.join("."), d.lhs, "->", d.rhs));
Python (deepdiff)
from deepdiff import DeepDiff  # pip install deepdiff

diff = DeepDiff(original, modified, ignore_order=False)
print(diff.pretty())

Frequently asked questions

How is this different from a regular text diff?

A text diff compares lines, so reordered keys, changed indentation, or minified-vs-pretty formatting produce walls of noise. A semantic diff parses both documents and compares the data, reporting {"a":1,"b":2} and {"b":2,"a":1} as identical. Use a text diff only when formatting itself matters.

Why does it flag "10" versus 10 as a type change?

Because that is one of the most damaging silent API changes: JavaScript consumers may coerce and survive, while Go, Java, Swift, and schema validators fail immediately. Type changes are separated from value changes so they stand out in the report.

How are arrays compared?

By position: index 0 against index 0, and so on, with extra elements reported as added or removed. Order matters in JSON arrays - [1,2] and [2,1] are genuinely different values. If your arrays are semantically sets, sort them before comparing (our JSON Sort tool orders object keys; sort array elements in code).

Can I compare two API responses automatically in code?

Yes - use a deep-equality assertion in tests (assert.deepStrictEqual in Node, DeepDiff in Python) or a dedicated library like deep-diff (JS) / deepdiff (Python) that produces a difference list similar to this tool. See the code examples below.

Last updated:

You might also need

Free and in-browser, like everything on JSON Console. Browse all tools →