How to Compare Two JSON API Responses
When an API response changes, a normal text diff can produce a lot of noise. A useful JSON comparison should distinguish structural changes, data-type changes and ordinary value changes—and recognize when an array simply changed order.
Compare your JSON with BreakDiff →
1. Capture a before and after response
Start with two valid JSON payloads: the response you expect and the new response you want to inspect. These might come from two API versions, production and staging, or two points in time.
{"id":123,"status":"pending","total":49.99}
{"id":"123","status":"completed","total":49.99}
2. Separate structural changes from value changes
A status changing from pending to completed is normally a data change. An id changing from a number to a string is different: consumers that expect an integer may fail. Removed fields can be similarly disruptive.
3. Look for potentially breaking changes
Pay particular attention to removed properties and type changes such as number → string, object → array, or value → null. Whether a change truly breaks a client depends on that client's contract and validation rules, so automated classification should be treated as a warning rather than proof.
4. Handle arrays carefully
Comparing arrays only by position can create false differences. If an API returns the same objects in a different order, an index-based diff may claim every item changed. When objects contain stable unique identifiers such as id, uuid, sku or key, matching by that identifier usually produces a more useful comparison.
5. Ignore volatile fields
Timestamps, request IDs and generated tokens often change on every request. Excluding paths such as $.timestamp or $.request_id makes meaningful differences easier to see.
Compare JSON in your browser
BreakDiff compares JSON locally in your browser and groups differences into potentially breaking changes, added fields and value changes. Your pasted JSON is not intentionally uploaded to BreakDiff.