View all services
Talk to QA Advisor
Free tool · Automation and API

JSON compare and diff

Paste an expected and an actual API response, or open two JSON files, and see exactly what changed: values, missing and extra fields, and type changes, each with its path. Key order never counts, arrays are aligned, and timestamps or IDs can be ignored.

JSON compare

Compare two JSON documents by structure, not text. Key order never counts, arrays are aligned so one inserted item is one difference, and you choose what to ignore.

Valid JSON
Valid JSON

Arrays

Position counts, but insertions and deletions are aligned rather than shifting everything after them.

A name matches at any depth. A path matches one place: * is any key, [*] any item.

4 differences1 field ignored

DifferencePathExpectedActual
Type changed$.total59.9number"59.90"string
Removed$.customer.tier"gold"not present
Changed$.items[2].price2018
Added$.items[1]not present{"sku":"CAP-02","qty":1,"price":12.5}
Export

Every difference as a row, for a spreadsheet or a test report.

Normalised viewBoth documents with keys sorted and indented, so you can read them side by side.
{
  "currency": "EUR",
  "customer": {
    "email": "[email protected]",
    "id": 381,
    "tier": "gold"
  },
  "items": [
    {
      "price": 19.95,
      "qty": 2,
      "sku": "TSHIRT-M"
    },
    {
      "price": 20,
      "qty": 1,
      "sku": "MUG-01"
    }
  ],
  "orderId": "ORD-1042",
  "status": "paid",
  "total": 59.9,
  "updatedAt": "2026-10-26T09:14:02Z"
}
{
  "currency": "EUR",
  "customer": {
    "email": "[email protected]",
    "id": 381
  },
  "items": [
    {
      "price": 19.95,
      "qty": 2,
      "sku": "TSHIRT-M"
    },
    {
      "price": 12.5,
      "qty": 1,
      "sku": "CAP-02"
    },
    {
      "price": 18,
      "qty": 1,
      "sku": "MUG-01"
    }
  ],
  "orderId": "ORD-1042",
  "status": "paid",
  "total": "59.90",
  "updatedAt": "2026-10-26T09:14:07Z"
}
Ready
How to use

How to use the JSON compare

  1. 1Paste the expected JSON on the left and the actual JSON on the right, or open a file on each side. The example shows an order response with typical differences.
  2. 2Choose how arrays compare: position matters, order ignored, or items matched by an ID field such as "id" or "sku".
  3. 3List the fields that change on every call, such as updatedAt or a request ID, so they do not hide the differences that matter.
  4. 4Read the differences by path, filter them by kind, and export them as CSV, Markdown for a ticket, JSON Patch, or a list of paths.

Why compare JSON by structure, not text

A text diff treats JSON as lines, so it reports differences that are not real and buries the ones that are. Reorder the keys of an object and every line looks changed, although the data is identical. Reformat one side and the diff fills with whitespace. A structural comparison parses both documents and compares values, so {"a":1,"b":2} and {"b":2,"a":1} are equal, 1 and 1.0 are the same number, and indentation never matters.

Each difference then comes with its path, such as $.items[1].price, which is what you need to write an assertion, file a defect or explain a failing test. A text diff gives you a line number in one particular formatting of the document.

How the four kinds of difference are reported

Changed means the field exists on both sides with a different value. Added means it exists only in the actual JSON, and removed means it exists only in the expected JSON. Type changed means the field exists on both sides but holds a different type, such as the string "59.90" where the number 59.9 was expected.

Type changes deserve attention in API testing. A price that becomes a string, a null where an object used to be, or a single item that is no longer wrapped in an array often passes a loose check and then breaks a client that parses the response strictly.

Arrays: order, alignment and matching by ID

Arrays are where most JSON diff tools mislead. Comparing item by item means one item inserted at the start reports every item after it as changed. This tool aligns the two arrays first, the way a good text diff aligns lines, so an insertion is one addition and an edit is one change, even when they sit next to each other.

When order carries no meaning, choose Ignore order: the same items in any order are equal, and duplicates are still counted. When items have an identifier, choose Match by key and enter the field, such as id or sku. Each item is then compared with its own counterpart wherever it moved, which is how most API test assertions should treat lists of records.

Ignoring the fields that always change

Responses captured at different times always differ in timestamps, request IDs, ETags and generated identifiers. Unless those are excluded, the comparison never comes back clean and the real differences are easy to miss. A bare name, such as updatedAt, skips that key wherever it appears. A path, such as $.meta.requestId or $.items[*].id, skips one place, with * standing for any key and [*] for any array item.

Keep the ignore list short and specific. Every field you ignore is a field your test no longer checks, so ignore what is generated, not what is inconvenient. The number of ignored fields is shown with the result so that it stays visible.

Using the result in API and contract testing

For a regression check, compare a response from the previous release with one from the release candidate. For a contract change, compare the documented example with what the service now returns. For a data migration, compare an export from the old system with one from the new.

The exports fit those workflows. The paths list drops straight into the ignore option of most assertion libraries. The Markdown table goes into a defect report. JSON Patch, the RFC 6902 format, describes the exact operations that turn the expected document into the actual one, which suits test fixtures and review.

QAble service

API testing

QAble builds API test suites that check structure, types and contracts, not just status codes, and run them on every build.

Explore the service
FAQ

Frequently asked questions

Is my JSON uploaded anywhere?

No. The comparison runs entirely in your browser and nothing is sent to a server, so it is safe for API responses that contain tokens, personal data or internal identifiers.

Does key order make a difference?

No. JSON objects are unordered, so {"a":1,"b":2} and {"b":2,"a":1} compare as equal. Array order does count by default, and you can switch that off or match items by an ID field.

How large can the JSON files be?

Several megabytes is fine on a typical laptop. A response with thousands of array items compares in well under a second. Very long arrays, over 3,000 items on both sides, are compared position by position rather than aligned, to keep the page responsive.

Why does a number show as a type change?

Because one side holds a number and the other a string, such as 59.9 and "59.90". They look alike but are different JSON types, and a strict client will treat them differently. Numbers of the same type are compared as numbers, so 1 and 1.0 are equal.

What is the number tolerance for?

Calculated values such as prices after tax or currency conversion can differ in the last decimal place between environments. A tolerance of 0.01 treats numbers within one cent as equal. Leave it empty to compare numbers exactly.

What does the JSON Patch export contain?

RFC 6902 operations that turn the expected document into the actual one. Arrays whose items were added, removed or moved are replaced whole, which keeps the patch correct, and every other difference is a single add, remove or replace.

Need the edge cases found for you?

QAble testers work through the inputs, payment paths and data that break products in production, before your users find them.

Talk to QA Advisor