JSON Formatter
Beautify, minify and validate JSON with error locations.
Your JSON is parsed and formatted locally in your browser, and nothing is uploaded to a server.
Want to explore JSON as a tree? Try the JSON Tree Viewer.
About JSON Formatter
This json formatter lets you paste raw JSON and instantly beautify, minify, or validate it without leaving the page. As a json beautifier it pretty prints with 2-space, 4-space, or tab indentation, and as a json minifier it collapses everything to a single compact line. The built-in json validator flags invalid input with the exact line and column of the first problem, so trailing commas, single quotes, and missing brackets are easy to spot. It is built for developers, QA engineers, and anyone debugging API responses, config files, or log payloads. The formatted output is syntax-highlighted and ready to copy or download. Everything runs locally in your browser, so your data never leaves your device and nothing is uploaded to a server.
Features
- Beautify JSON with 2-space, 4-space, or tab indentation
- Minify JSON to a single compact line
- Validate JSON with the exact error line and column
- Sort object keys alphabetically at every level in Prettify mode
- Syntax-highlighted output for easy reading
- Copy or download the formatted result in one click
- Handles large and deeply nested JSON documents
How to use the JSON Formatter
- Paste or type your JSON into the input box.
- Choose Prettify and pick 2-space, 4-space, or tab indentation, or choose Minify.
- Optionally enable Sort keys to alphabetize object keys.
- Review the syntax-highlighted output, or read the line and column shown for any error.
- Click Copy or Download to save the formatted JSON.
Example
Input
{"name":"Ada","langs":["sql","js"],"active":true}
Output
{
"name": "Ada",
"langs": [
"sql",
"js"
],
"active": true
}
Beautified with 2-space indentation.
Common errors & troubleshooting
- "Unexpected token" error on otherwise valid-looking JSON. — Check the reported line and column for a trailing comma, single quotes, or an unquoted key. JSON requires double quotes and no comma after the last item.
- Pasting a JavaScript object instead of JSON. — Wrap all keys and string values in double quotes and remove comments; JSON does not allow unquoted keys or // comments.
- Minified output is hard to read. — Switch to Prettify mode and pick an indentation size to expand the JSON again.
- Keys appear in an unexpected order. — Enable Sort keys in Prettify mode to alphabetize keys at every level of the structure.
Frequently asked questions
- What is the JSON Formatter and what does it do?
- The JSON Formatter beautifies, minifies, and validates JSON in one place. Paste raw JSON to pretty print it with your chosen indentation, collapse it to one line, or catch syntax errors with their exact line and column.
- How do I fix "Unexpected token" errors in the JSON Formatter?
- The validator shows the line and column of the first problem. Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, or a missing bracket.
- Can the JSON Formatter sort object keys?
- Yes. Turn on Sort keys in Prettify mode to alphabetically order keys at every level of the object.
- How do I minify JSON with the JSON Formatter?
- Choose Minify mode and the formatter collapses your JSON to a single compact line, ready to copy or download.
- What indentation options does the JSON Formatter support?
- You can beautify with 2-space, 4-space, or tab indentation, and the output is syntax-highlighted for readability.
- Is my JSON sent anywhere when I use the JSON Formatter?
- No. The JSON Formatter runs entirely in your browser, so your data never leaves your device and nothing is uploaded to a server.
Related tools
- JSON Viewer — Text + collapsible tree viewer with expand/collapse and node paths.
- JSON Tree Viewer — Explore JSON as a collapsible, typed tree.
- JSON to TypeScript — Generate TypeScript interfaces from a JSON sample.
- JSON to CSV — Convert an array of flat JSON objects to CSV.
- JSON Escape / Unescape — Escape text into a JSON string or unescape a JSON string back to raw text.
- YAML ↔ JSON — Convert YAML to JSON and back.
- XML Formatter — Beautify, minify and validate XML, and convert XML ↔ JSON.
- SQL Formatter — Format SQL for MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and Oracle.
All ArrayKit tools