Overview
Introduction
API responses copied from a terminal or a browser's network panel are often a single unbroken line of JSON, sometimes with headers stacked on top, that's painful to read as-is.
This tool reformats just the JSON body with proper indentation, leaving any header block above it untouched, entirely in your browser.
What Is API Response Formatter?
A pretty-printer specialized for pasted API responses: it recognizes the header-block-then-body shape curl -i and browser dev tools produce, and only reformats the JSON part.
It's part of this site's API Tools collection and runs entirely client-side.
How API Response Formatter Works
The input is scanned for the first blank line, the conventional separator between an HTTP response's headers and its body; everything after that point is treated as the body.
The body is parsed as JSON and re-serialized with 2-space indentation; any header block found above it is reattached unchanged.
When To Use API Response Formatter
Use it right after copying a response out of curl -i, Postman's console, or a browser's network tab, before you read through it.
It's also just a convenient JSON formatter when you paste a bare, unindented JSON body with no headers at all.
Often used alongside jq Playground.
Features
Advantages
- Handles both a bare JSON body and a full raw-response paste without needing to strip headers first.
- Leaves headers exactly as pasted, so nothing about the response's metadata gets altered or reordered.
Limitations
- Only reformats JSON bodies; XML, HTML, or plain-text response bodies are passed through as an error, not reformatted.
- Relies on a blank line to detect a header block; a response paste missing that blank line is treated as a bare body instead.
Examples
Best Practices & Notes
Best Practices
- Copy responses with curl -i (or your API client's "copy raw response" option) if you want the headers preserved alongside the formatted body.
- Strip everything before the header block (like a shell prompt or command echo) if formatting fails; stray leading text confuses the header/body split.
- Use the JQ Playground afterward if you need to extract or filter specific fields rather than just read the whole body.
Developer Notes
The header/body split looks for the first \n\n or \r\n\r\n sequence, matching the blank-line separator defined by HTTP's message format, rather than trying to parse each line as a header field, so it works regardless of which headers are present.
API Response Formatter Use Cases
- Reading a minified API response copied from a terminal or log file
- Reformatting a response pasted from a browser's network panel before sharing it in a bug report
- Quickly pretty-printing a bare JSON payload without headers
Common Mistakes
- Pasting a response body that's actually HTML (a common shape for error pages) and expecting JSON formatting to apply.
- Including a shell prompt or curl command line above the response, which breaks the header/body blank-line detection.
Tips
- Paste the exact output of curl -i to get both the header block and a nicely formatted body in one pass.