JSON Formatter
Indents, sorts or minifies JSON, keeping every number exactly as you wrote it.
Results
What this tool does
A wall of minified JSON is unreadable, and a nested structure is impossible to follow without indentation. Paste it here and it comes back laid out, with the field count and the nesting depth alongside so you can see how big the thing actually is. Sorting the keys is the trick for comparing two versions of the same document: put both through sorted and the diff shows only what genuinely changed. Everything happens in your browser — the text is never sent anywhere.
Formula
reads the JSON and writes it back with the indentation you asked for
Variables
| Symbol | Meaning | Unit |
|---|---|---|
text | JSON | — |
mode | What to do | — |
indent | Spaces of indentation | — |
OUT | Formatted JSON | — |
FD | Fields | — |
DP | Nesting depth | — |
SB | Size before | B |
SA | Size after | B |
Worked example
- JSON{"nome":"Ana","idade":30,"marcas":[1,2,3],"morada":{"rua":"A","n":7}}
- What to dopretty
- Spaces of indentation2
- Formatted JSON{ "nome": "Ana", "idade": 30, "marcas": [ 1, 2, 3 ], "morada": { "rua": "A", "n": 7 } }
- Fields6
- Nesting depth2
- Size before69 B
- Size after119 B
Limitations
- The calculation runs entirely in your browser. The values you type are never sent to a server.
Frequently asked questions
Does it change my numbers?
No, and that is deliberate. Most formatters parse the JSON into their language's own values and write them back out, which quietly turns 1.0 into 1 and 1e30 into 1e+30, and can lose digits on anything longer than fifteen. This one keeps every number exactly as you typed it, because a formatter's job is to change the layout and nothing else.