Most modern REST APIs exchange data as JSON — JavaScript Object Notation. It is a lightweight, human-readable format of key/value pairs, and validating it is at the heart of API testing.
JSON in a nutshell
- Objects — wrapped in
{ }, holding key/value pairs. - Arrays — wrapped in
[ ], holding ordered lists. - Values — strings, numbers, booleans, null, objects, or arrays.
Sending and validating JSON
Build JSON body
→
Send request
→
Parse response JSON
→
Assert on fields
What to validate in a JSON response
- Structure — the expected keys are present.
- Types — each field has the right data type.
- Values — specific fields hold the expected data.
- Schema — the whole body matches a defined schema.
Tip: schema validation is powerful — it catches when an API quietly changes its response shape, a common cause of broken integrations.
Conclusion
JSON is the language modern APIs speak, and testing it means checking structure, types, and values — ideally against a schema. Comfortable JSON handling is what turns a request into a genuine, meaningful test.