JSON:API
JSON:API is a REST API response format specification that standardizes resource objects, relationships, pagination, and errors, reducing API design divergence.
Purpose
To give REST APIs a unified response structure so clients can handle resources, relationships, and errors generically.
Mechanism
Responses contain data (resource object array/object), included (side-loaded related resources), meta, and errors. Resource objects contain id, type, attributes, and relationships; relationships reference links or data.
Use cases
- Standardizing REST API responses
- Frontend-backend data contracts
- Pagination and compound loading