Free · runs in your browser
JSON Formatter & Beautifier
Paste JSON and make it readable in one click. It runs in your browser, so nothing you paste is uploaded, and any error shows its line and column.
Paste JSON above, or load the sample.
How to format JSON
- Paste your JSON into the Input box, or press Sample to try it.
- Press Format (or Ctrl/Cmd + Enter). Choose 2 spaces, 4 spaces or tabs first if you have a house style.
- Tick Sort keys if you want stable alphabetical order, then press Copy.
If the input is invalid, the status bar shows the parser's message with the line and column. The guide to the six most common JSON errors covers each fix.
Before and after
{"user":{"id":1042,"roles":["admin","editor"]},"active":true}becomes
{
"user": {
"id": 1042,
"roles": [
"admin",
"editor"
]
},
"active": true
}What counts as valid JSON
JSON is stricter than a JavaScript object literal. Keys and strings use double quotes, there are no trailing commas and no comments, and the only values are objects, arrays, strings, numbers, true, false and null. The format is defined in RFC 8259.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Parsing and formatting run in your browser with JavaScript's built-in JSON parser. The text never leaves your device.
What is the difference between formatting and validating?
Validating only tells you whether the text is legal JSON. Formatting also rewrites it with consistent indentation so a person can read it. Formatting only works on valid JSON, so a format that fails is also a validation failure.
What does Sort keys do?
It rewrites every object with its keys in alphabetical order, at every depth. Arrays keep their order. Sorted output makes two documents much easier to compare line by line.
Why does formatting change my big numbers?
JavaScript reads JSON numbers as 64-bit floats, so integers larger than 9,007,199,254,740,991 can lose precision. If you handle IDs that large, keep them as strings.
Is there a size limit?
This page sets none. Documents of tens of megabytes may be slow because everything runs in your browser's memory.