Data Formats
JSON Diff Guide: Compare API Responses and Find Breaking Changes
Compare old and new JSON payloads to identify added, removed, and changed values, detect schema drift, and build better regression tests for APIs and integrations.
In this article
JSON Diff Guide: Compare API Responses and Find Breaking Changes
Duck Cloud's JSON Diff / Compare compares nested JSON and identifies added, removed, and changed values.
Why structure-aware diff helps
A plain text diff can become noisy because of indentation or line breaks.
A JSON-aware comparison focuses on data structure.
Removed fields
If a field disappears, a frontend depending on it may fail immediately.
Type changes
Old:
{"count":12}New:
{"count":"12"}Both are valid JSON, but the type changed.
null vs missing
A property becoming null is different from being removed completely.
Arrays
Array order can complicate comparisons. Know whether ordering is part of the API contract.
Validate both sides
Use JSON Validator if either document may be malformed.
Use JSON Viewer to inspect each response individually.
Regression workflow
- Save a known-good response.
- Reproduce the failing response.
- Remove secrets and volatile data.
- Diff them.
- Identify the changed path.
- Confirm against the API contract.
- Add an automated regression test.
Volatile values
Timestamps, request IDs, UUIDs, and durations can change every request. Normalize them only if they are irrelevant to the behavior being tested.
A JSON diff turns “the API changed” into a precise statement about which path, value, or type changed.