Why APIs use JSON
When your browser or app calls a web API, the server needs to send structured data back in a format both sides understand. JSON won out over alternatives like XML for most modern APIs because it's compact, maps directly onto data structures every language already has (objects, arrays, strings, numbers), and requires far less code to parse and generate.
Request and response bodies
A typical API exchange sends a JSON object in the request body (for POST/PUT requests) and receives a JSON object or array back in the response body. Both are typically marked with an application/json content-type header, which tells the receiving system how to interpret the raw bytes.
REST APIs vs. the JSON:API specification
This is where naming gets confusing: "a JSON API" (lowercase, generic) just means an API that uses JSON — the vast majority of REST APIs. JSON:API (with the colon) is a specific, formal specification that defines exact conventions for structuring resources, relationships, and errors within JSON responses. Most APIs you'll encounter use plain, ad-hoc JSON structures rather than following the JSON:API spec.
Common gotchas
A frequent one: some APIs stringify their JSON payload twice, so the response body is itself a JSON string containing another JSON string — our JSON Parser handles this automatically. Another: dates in JSON are just strings (JSON has no native date type), so both sides need to agree on a format like ISO 8601.