API Response Formatter
Format, beautify and highlight JSON/XML API responses instantly.
Turn a wall of API output into something you can read
When you call an API from a terminal, a log file or a browser network tab, the body often arrives as one long line of minified JSON or XML. The API Response Formatter takes that raw text, works out whether it is JSON or XML, and prints it back with consistent indentation and colored syntax. It is aimed at developers who need to inspect a payload quickly without opening an editor or installing a plugin.
Using the formatter step by step
- Paste the raw response into the Input Data box. If you only want to try it, click Sample to load a small login-style JSON response.
- Click Process Now.
- Read the result in the panel below. A summary row shows the Detected Format (JSON or XML) and the input length in characters.
- Use Copy to put the formatted text on your clipboard, or Download to save it as a text file named result.txt.
- Click Clear to empty the box before pasting the next response.
How detection and formatting work
The tool first tries to parse your input as JSON. If that succeeds, it re-prints the data with four-space indentation and colors keys, strings, numbers, booleans and null differently. If parsing fails and the text begins with a less-than sign, it treats the input as XML and places each tag on its own line with nested indentation. Anything else produces an error message asking for valid JSON or XML. All of this happens with JavaScript in your browser page.
Where it helps
- Checking a webhook payload copied from a provider dashboard before writing a handler for it.
- Reading a SOAP-style or legacy XML reply that arrives without line breaks.
- Making a response readable before pasting it into a bug report or a pull request description.
- Comparing the shape of a live response with the example in an API's documentation.
Things to keep in mind
JSON must be strictly valid: trailing commas, single-quoted strings and unquoted keys will fail the parse, and the tool will then report an error unless the text starts with an angle bracket. The XML indenter is a simple line-based approach, so it suits ordinary documents but is not a validator, and it will not repair unbalanced tags or reorder attributes. Comments, CDATA sections and mixed content may not indent the way a full XML editor would. If you paste a response that includes HTTP headers above the body, remove them first, since only the body should be formatted.
Formatting changes only whitespace and colors in what you see. Copy and Download use the plain text of the result, so you get clean indented output without any styling markup.
Related Articles
Related Tools