JSON Formatter & Pretty Printer
Paste messy JSON and get a clean, indented, readable result in one click. Everything runs locally in your browser.
FORMAT
INDENT
Tips
Paste JSON in the left pane. Output updates instantly.
How it works
Pretty printing runs JSON.parse on your input to validate it and turn the text into an in-memory tree, then JSON.stringify re-serialises the tree with two-space indentation, or four spaces if you pick that option. The two-space default matches the most common style guides and produces output that is easy to read in a diff or a pull request review.
Example
Input on one line, output with the default two-space indent:
{"b":1,"a":[true,null]}{
"b": 1,
"a": [
true,
null
]
}Processing runs in your browser
All processing happens inside your browser tab. Our servers are not involved at any point.
Technical specification
JSON syntax is defined in RFC 8259 (IETF, 2017) and ECMA-404. The tool parses with the browser's strict JSON.parse, so comments and trailing commas are errors, and writes the result with JSON.stringify.
- Standard
- ECMA-404 / RFC 8259
- Browser API
- Native
JSON.parseandJSON.stringify - Indent
- 2 or 4 spaces (none when minifying)
- Size limit
- Browser memory
Related operations
For converting between data formats, try CSV to JSON or the YAML formatter. To decode tokens, use the JWT decoder. For escaping URL data, try URL encode.
Frequently asked questions
- Is my JSON data sent to a server?
- All processing runs in your browser using JavaScript's built-in JSON.parse and JSON.stringify.
- What indentation does it use?
- Two spaces by default, which is the most common convention. You can switch to four spaces.
- What if my JSON is invalid?
- The tool shows an error message, with the line and column where the syntax breaks when the browser reports them.
- Does pretty-printing change the key order?
- Keys stay in the order you wrote them, with one exception that comes from JavaScript objects: keys that are whole numbers, such as "2" or "10", move to the front in numeric order. Choose Sort keys to put the other keys in alphabetical order as well.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to data tools
- Step by step: Turn a CSV into clean JSON for an API