Reading JSON Responses
Nested objects, arrays, null values, error envelopes, and pagination metadata
JSON structure vocabulary
- data — the actual payload; meta — metadata (pagination, totals); errors — error details
- null — intentional absence of a value (different from a missing key)
- nested object — object inside another:
data.order - response envelope — wrapper structure:
{"status": "ok", "data": {...}} - retry_after — seconds to wait before retrying after a 429 error
Question 0 of 5
Read this API response and answer: what does the meta object represent?{"data": [...], "meta": {"total": 245, "page": 3, "per_page": 20}, "links": {"next": "/api/users?page=4"}}
- data — the actual response payload (array, object)
- meta — metadata about the response (pagination, totals, timestamps)
- links — hypermedia links (next, previous, self) — part of JSON:API spec
- errors — error details (when request fails)
An API returns: {"user": null, "error": null}. What does a null value mean in JSON?
{"user": null}— the key exists, its value is explicitly null{}— the key is absent entirely- These have different semantics in APIs: null often means "no data found," while a missing key may mean "not applicable" or "not yet loaded"
Describe the structure of this response in one sentence: {"status": "success", "data": {"id": 42, "order": {"items": [{"sku": "A1", "qty": 2}], "total": 29.99}}}
- "nested object" — an object inside another object:
data.order - "array of objects" —
itemsis an array:[{sku, qty}] - "flat structure" — all fields at the top level (no nesting)
An API returns this error response: {"error": {"code": "RATE_LIMIT_EXCEEDED", "message": "Too many requests. Retry after 60 seconds.", "retry_after": 60}}
What should the client do?
- error code / error type — machine-readable error identifier (
RATE_LIMIT_EXCEEDED) - message — human-readable description
- retry_after — number of seconds to wait before the next attempt
429 Too Many Requests status code. The retry_after field corresponds to the HTTP Retry-After header. Client implementation: exponential backoff with respect for the retry_after value.What does the term "response envelope" mean in REST API design?
- Without envelope:
[{id: 1}, {id: 2}]— direct array or object - With envelope:
{"status": "ok", "data": [{id: 1}]}— data is nested inside a wrapper