Skip to content

FIELD NOTES / A DECISION GUIDE

Compare two API response shapes with a small JSON fixture

An API can still return valid JSON after a change that breaks its clients. For example, a new response might put items under data while an older client reads it at the root. A small fixture makes that kind of change visible without sharing customer records.

Prepare two synthetic responses

{"items":[{"id":"A17","available":true}],"next":null}
{"data":{"items":[{"id":"A17","available":true}]},"next":null}

Format one line at a time and compare the indentation. In the first response, items[0].id is present. In the second the same value is at data.items[0].id. Both documents should format successfully.

Verify what the client consumes

  1. Write down the old and new field paths.
  2. Test a populated array and an empty array in the actual client.
  3. Check next independently. An explicit null and a missing field can trigger different behavior.

Keep the synthetic response with the regression test. Pretty-printing checks the JSON structure visually. The client test verifies the contract.

Open the JSON formatter or browse all three tool guides.