QA ENGINEERING GUIDE
How to Test JSON APIs
Practical JSON validation and negative testing techniques.
Validate syntax
The response must be valid JSON when the API contract specifies JSON. Invalid JSON should normally be treated as a server defect.
Validate structure
Check required properties, nesting, arrays and object structure. Schema validation is useful when an API has a formal contract.
Validate types
A field expected to be an integer should not silently become a string. Test booleans, numbers, strings, arrays and null values according to the contract.
Negative and edge cases
Try missing properties, empty strings, nulls, oversized values, unexpected enum values and boundary values.
Avoid brittle assertions
Don't compare the entire response when fields such as IDs, timestamps or generated tokens are expected to change. Assert stable business properties instead.