# Find the Actual Change Between Two API Responses

> Two API responses look almost identical, but amount changed from a number to a string. Use JSON Diff to find that path, read array changes correctly, and decide which differences need a contract test.

- Author: [Shashank Rawlani](https://shashank.rawlani.com)

- Published: 2026-09-27T05:30:00.000Z

- Updated: 2026-10-14T10:26:49.397Z

- Category: Tools & Reviews

- Canonical source: https://automationtester.in/blog/tools-reviews/compare-api-responses-json-diff

- Tags: json-diff, api-testing, contract-testing, json

Paste the old and new JSON responses into [JSON Diff](https://automationtester.in/tools/json-diff). The result names changed values by path and separates additions, removals, and type changes. Use that list to decide which differences deserve an assertion or a contract review.

An API test says only that the response changed. Scanning two formatted payloads can miss a number that became a string, especially when most fields stayed the same. A plain text diff also spends space on indentation and property order. Start with the values.

## A payment response with three changes

Open the tool. Replace the left pane with the earlier response and the right pane with the new one. The comparison updates as you edit; there is no run button.

```
{"id":"A-17","status":"pending","amount":499,
 "items":[{"sku":"P1","qty":1}]}
```

```
{"id":"A-17","status":"paid","amount":"499",
 "items":[{"sku":"P1","qty":1}],"paymentId":"p_8"}
```

[Try this in JSON Diff](https://automationtester.in/tools/json-diff#p=eyJ2IjoxLCJsZWZ0Ijoie1wiaWRcIjpcIkEtMTdcIixcInN0YXR1c1wiOlwicGVuZGluZ1wiLFwiYW1vdW50XCI6NDk5LFxuIFwiaXRlbXNcIjpbe1wic2t1XCI6XCJQMVwiLFwicXR5XCI6MX1dfSIsInJpZ2h0Ijoie1wiaWRcIjpcIkEtMTdcIixcInN0YXR1c1wiOlwicGFpZFwiLFwiYW1vdW50XCI6XCI0OTlcIixcbiBcIml0ZW1zXCI6W3tcInNrdVwiOlwiUDFcIixcInF0eVwiOjF9XSxcInBheW1lbnRJZFwiOlwicF84XCJ9In0)

The result has `1 added`, `0 removed`, `2 changed`, and `3 unchanged` leaf values. It lists `status` as changed, `amount` as a *type change*, and `paymentId` as added. The `id` and the two fields inside `items[0]` did not change. That is more useful than a red/green block around the whole response: `amount` now needs a contract decision, while `paymentId` may be an intentional addition.

## Read the paths before fixing tests

The tool parses both panes as JSON and walks matching object keys and array positions. `items[0].qty` is the quantity in the first array element. If an item moves from index 0 to index 1, the tool compares those positions and may report several changes even when the item itself is unchanged. It does not match records by `sku` or another identity field.

That matters for API assertions. If item order is part of the contract, positional differences are evidence. If order is irrelevant, compare items by a stable key in the test instead. [JSON Formatter](https://automationtester.in/tools/json-formatter) helps when either side is invalid; this diff tool reports which pane failed to parse, but it cannot infer a missing comma's intended value.

## A difference is not a verdict

The tool reports structure and values, not whether a release is compatible. RFC 8259 defines an object as an unordered collection and an array as ordered; the tool's positional array comparison follows that distinction. A new optional property may be harmless for one consumer and break another that rejects unknown fields. Check the actual consumer contract before labeling a change safe.

For a repeated check in CI, write an assertion or validate against the agreed schema. A browser comparison is useful during investigation, but it is not a stored regression test.

## Two questions to settle

**Does key order matter here?** JSON object member order carries no meaning in RFC 8259, and the tool compares keys rather than text positions. Array order does affect its result.

**Can I paste a broken response?** You can, but the tool stops at the JSON parse error and identifies the invalid pane. Repair or isolate that input before interpreting differences.

## Carry the changed paths into a test

Compare one response from before and after a real change. Save the changed paths, the two values, and the consumer decision. Turn each consequential difference into a test that checks the intended contract.

## JSON semantics and tool reference

- [RFC 8259, JSON Data Interchange Format](https://www.rfc-editor.org/info/rfc8259/): object and array semantics, plus the JSON grammar.

- [AutomationTester.in JSON Diff](https://automationtester.in/tools/json-diff): the comparison interface and its displayed result.

## Continue reading on AutomationTester.in

- [Create a Failure Triage Toolkit Before the Next Flake](https://automationtester.in/blog/tools-reviews/failure-triage-toolkit-before-flake)
- [Test Cron Schedules by Their Fire Times, Not Their Strings](https://automationtester.in/blog/tools-reviews/verify-cron-schedules-time-zones-boundaries)
- [Build a k6 Load Model from Real Traffic, Not a VU Count](https://automationtester.in/blog/tools-reviews/generate-k6-load-model-traffic-assumptions)
- [Freeze Generated Test Data Before CI Needs It](https://automationtester.in/blog/tools-reviews/freeze-generated-test-data-fixtures)
- [Review Required Fields in a Generated JSON Schema](https://automationtester.in/blog/tools-reviews/review-generated-json-schema-required-fields)

Source: [Find the Actual Change Between Two API Responses](https://automationtester.in/blog/tools-reviews/compare-api-responses-json-diff) by Shashank Rawlani.
