How to validate API response JSON

API response validation is not just about syntax. A response can be valid JSON and still be wrong for your client, test, or integration because a field is missing or a value has the wrong type.

Step 1: validate syntax

First confirm the response is valid JSON. If the payload cannot be parsed, the rest of the validation workflow will not matter.

Step 2: format the response

Pretty printing the payload exposes the structure and makes it easier to inspect nested arrays and objects.

Step 3: validate the contract

If the client expects a specific shape, validate the response against a schema or compare it to a known-good response.

Step 4: isolate nested values

Use JSONPath to check the exact field that a test or client relies on.

FAQ

Is valid JSON enough for an API response?

No. The response may still break the client if the shape or values are wrong.

Why compare responses between environments?

Diffing staging and production responses can reveal subtle field or type changes.

What tool helps with nested paths?

Use JSONPath Tester to target specific nested values.

Can I keep all of this local?

Yes. MyJSONTool runs these workflows in the browser.