JSON Formatter
Format an API response or configuration file into readable JSON. Choose your indentation, apply consistent spacing, and copy the result. Your JSON is processed entirely in your browser.
JSON source editor
Format JSON for API and configuration workflows
Copied API responses often arrive on one line, while manually edited configuration files can mix indentation styles. This formatter gives valid JSON a consistent layout so you can follow nesting and review individual properties. Paste your source, choose an indentation style, and format it before copying it into a request example, a fixture, or your project.
How to use the JSON Formatter
- Paste the JSON response or configuration into the source editor.
- Choose two spaces, four spaces, or tabs, then select Format JSON.
- Review the formatted document and copy it back into your workflow.
JSON Formatter example
{"request":{"method":"GET","path":"/products"},"response":{"status":200,"items":[{"id":"item-42","available":true}]}}Formatting separates the request and response properties into readable blocks. Use the tree view to inspect the nested items array alongside the formatted source.
Syntax checks and data representation
The tool uses JavaScript JSON parsing. Syntax validation does not check a schema or application rules. Formatting and minification parse and serialize the document: duplicate property names collapse to the last value, integer-like keys may reorder, and numbers beyond JavaScript’s safe integer range can lose precision. Keep long numeric identifiers as strings and retain your original source when exact representation matters.
JSON Formatter questions
How do I format an API response as JSON?
Copy the JSON response body into the editor, choose an indentation style, and select Format JSON. Include only the JSON body, not HTTP headers or a JavaScript variable assignment.
Can I reformat JSON that already has indentation?
Yes. Formatting parses the document and applies the selected indentation consistently, whether the input is compact or already spread across several lines.
Why does the formatter reject my copied response?
The response may contain HTML, plain text, comments, or invalid JSON syntax. Review the validation message and confirm that you copied a JSON response body. The formatter does not convert other formats or automatically repair invalid input.