JSON Formatter & Validator — Beautify and Fix JSON Online
Beautify, validate, and minify JSON with the exact line and column of any syntax error. Pretty-print API responses, catch trailing commas, and copy clean output — nothing is uploaded.
Examples
{"id":42,"tags":["a","b"],"meta":{"ok":true,"ts":1718000000}}{
"id": 42,
"tags": ["a", "b"],
"meta": {
"ok": true,
"ts": 1718000000
}
}Same data, readable structure — ready to paste into a ticket.
{ "name": "ada", "active": true, }Error: Unexpected token } at line 1, column 34
JSON forbids a comma before a closing brace — remove it and re-format.
How to use this tool
- Paste your JSON — including minified or escaped strings — into the input box.
- Choose the indentation size (2 or 4 spaces).
- Click Format JSON; if it is invalid, read the error to find the bad character.
- Copy the beautified output or download it as a .json file.
What is JSON Formatter?
JSON Formatter takes compact, escaped, or malformed JSON and turns it into clean, indented, readable output while validating it as you go. When parsing fails it reports the exact line and column and the character it choked on, which makes spotting a trailing comma or an unquoted key far faster than scanning a wall of minified text. It is built for the everyday loop of pasting an API response, eyeballing the shape of the data, and copying a tidy version into a ticket, test fixture, or commit.
Specifications
| Standard | ECMA-404 / RFC 8259 JSON |
|---|---|
| Indentation | 2 or 4 spaces |
| Comments | Not supported (JSON has no comments) |
| Max input | Limited only by your browser's memory |
Tips & gotchas
- JSON requires double quotes — single quotes and unquoted keys are invalid, even though JavaScript allows them.
- Trailing commas before a } or ] are the most common error; the validator points you to the exact line.
- Formatting preserves key order and never removes keys, so a diff after formatting shows whitespace-only changes.
- For huge payloads, format to read it, then Minify to compare byte sizes before sending it over the wire.
Features
- Format JSON with 2 or 4 space indentation
- Validate with the exact line and column of an error
- Minify back to a single line in one click
- Copy formatted output or download as a .json file
- Handles deeply nested objects and large payloads
When to use it
- Inspecting a long API response to find which field is null before filing a bug.
- Cleaning up a one-line config blob from an env var so a teammate can read it in a PR.
- Turning a minified webhook payload into a readable fixture for a unit test.
- Validating hand-edited config like package.json or tsconfig before committing.
This tool runs in your browser. Your files and text are not uploaded to our servers, and we do not store your input.
Frequently asked questions
Why does my JSON say invalid when it looks fine?+
The usual culprits are single quotes instead of double quotes, unquoted keys, or a trailing comma before a } or ]. The error message gives the line and column so you can jump straight to it.
Does formatting change my data or reorder keys?+
No. Formatting only adds indentation and line breaks. Values, types, and key order are preserved, so a diff shows whitespace-only changes.
What's the difference between formatting and minifying?+
Formatting adds whitespace for readability; minifying removes it to shrink the payload. They are lossless inverses — minify before sending JSON over a network, format when you need to read it.
Is my JSON uploaded to a server?+
No. Parsing and formatting happen in your browser, so the data never leaves your device — safe for payloads containing tokens or personal data.
Related tools
Related guides
Looking for more Developer Tools?
Browse the full collection of free, browser-based tools.