Developer guide
Format an API response for debugging
Raw API responses are often minified. Formatting gives each object and array enough space to inspect quickly.
The problem
When debugging an endpoint, a formatted response makes it easier to find status fields, IDs, nested errors, and unexpected null values.
Example
{"status":"error","errors":[{"field":"email","message":"Already used"}],"requestId":"req_123"}
{
"status": "error",
"errors": [
{
"field": "email",
"message": "Already used"
}
],
"requestId": "req_123"
}
How to fix it
- Copy the response body from your API client, browser network panel, or logs.
- Format it before scanning nested arrays or error objects.
- Keep request IDs, timestamps, and status fields visible when sharing a bug report.
What to copy from an API client
Copy only the response body when you want to format JSON. Status codes, response headers, and curl progress output are useful context, but they are not part of the JSON value.
If the formatter fails on an API error, check whether the server returned HTML or plain text. Many error pages look like responses in the network panel but are not JSON.
Common mistakes
- Copying headers together with the JSON body
- Pasting a truncated response
- Formatting HTML error pages as if they were JSON
- Missing that a response body is a JSON string, not an object
Related problems
FAQ
Can I format JSON copied from curl?
Yes, as long as you copy only the response body and it is valid JSON.
Why does the formatter fail on some API errors?
The response may be HTML, plain text, or a partial body instead of JSON.
Does formatting change the response data?
No. It only changes whitespace after the JSON parses.