API Response Formatter
Pretty-print, minify, or sort keys of a JSON API response in your browser.
Written by Golam Rabbani, Founder & Lead Engineer
How to use this api response formatter
- Paste a JSON API response into the text area.
- Pick a mode: pretty-print, minify, or sort keys + pretty-print.
- Choose an indent size — 2 spaces, 4 spaces, or tab (ignored when minifying).
- Press Format to validate and rewrite the JSON.
- Use Copy to grab the formatted result or Reset to clear the form.
About this api response formatter
The API response formatter parses your JSON with the native parser, so any syntactic error reports back with a line and column. Pretty-print uses JSON.stringify with your chosen indent; minify strips every byte of whitespace; sort mode walks the object tree and rebuilds it with every nested object's keys sorted alphabetically — handy for diffing two responses that returned the same data in different key orders. Each result reports a "before → after bytes" count so you can see exactly how much the format change cost or saved.
Worked example: paste {"id":42,"name":"Ada","tags":["admin","beta"]} (43 bytes), pick "Sort keys + pretty-print" with 2-space indent. The tool emits: { "id": 42, "name": "Ada", "tags": [ "admin", "beta" ] }
with the counter showing 43 → 73 bytes. Switch to "Minify" on the same input and you get the original 43-byte one-liner back. Everything stays in your browser — no upload, no logging.
FAQ
- What does sort-keys mode do?
- It recursively walks every nested object and reorders the keys alphabetically before pretty-printing. Array order is preserved. This makes two responses with identical data but different key orders diff cleanly.
- Will it tell me where the JSON is broken?
- Yes. When the native parser throws an error that mentions a byte position, the tool converts that to a line and column count so you can jump to the bad character instead of staring at one long line.
- Is there a size limit?
- The tool runs in your browser. Multi-megabyte responses work but consume memory while pretty-printing. For very large payloads, minify first to see whether the bytes you actually care about are small enough.
- Does minify change the data?
- No. Minify removes whitespace and newlines but preserves every key and value byte-for-byte. The semantic JSON is identical.
- Can it format YAML or XML?
- No — this tool is JSON-only. For other formats use our YAML to JSON, XML Formatter, or HTML Formatter tools.
- Is my response data uploaded anywhere?
- No. Parsing and rewriting happen entirely in your browser. The response text never leaves the page.