How to format JSON
- Paste your JSON into the input box.
- Choose the indentation (2 or 4 spaces, or a tab) and, if you want, sort the keys.
- Click “Format” to beautify it or “Minify” to squeeze it into a single line.
- Copy the result. If there's an error, the cursor jumps to the spot where it fails.
What a JSON formatter is for
JSON is the most widely used data format in APIs and config files. When it arrives all on one line it's hard to read: the formatter adds line breaks and indentation so you can see its structure.
It also works as a validator: if a comma is missing, there's an extra brace or you used single quotes instead of double quotes, it tells you the line and column where the JSON stops being valid.
Minifying does the opposite: it removes spaces and line breaks so the text is smaller to send or store.
Things to keep in mind
- It only accepts standard JSON: no comments, single quotes or trailing commas.
- With very large texts (several megabytes) the page can be slow, depending on your device.
- Very large numbers or numbers with many decimals can lose precision, just like in JavaScript.
Frequently asked questions
Is my JSON sent to a server?
No. It's processed in your browser and the text never leaves your device, so you can use it with private data.
Why does it say my JSON is invalid?
The most common causes are an extra or missing comma, single quotes instead of double quotes, unquoted keys or an unclosed brace. The message shows the line and column.
What's the difference between formatting and minifying?
Formatting adds line breaks and indentation to make it easier to read; minifying removes them so it takes up less space.
Can I sort the keys?
Yes, with the alphabetical sort option. It's handy for comparing two JSON files or for getting the same output every time.
Is it free?
Yes, it's free, needs no sign-up and works right in your browser.