Pretty-print JSON with 2- or 4-space indentation
Pretty-printing turns compact JSON into one value per line and indents each nesting level, so the structure is easy to read and compare. The formatter offers 2 or 4 spaces per level.
Worked example
{"id":7,"name":"Ada","roles":["admin","editor"],"settings":{"theme":"dark","alerts":false},"tags":[]}{
"id": 7,
"name": "Ada",
"roles": [
"admin",
"editor"
],
"settings": {
"theme": "dark",
"alerts": false
},
"tags": []
}- Lines
- 13
- Characters
- 150
{
"id": 7,
"name": "Ada",
"roles": [
"admin",
"editor"
],
"settings": {
"theme": "dark",
"alerts": false
},
"tags": []
}- Lines
- 13
- Characters
- 180
Rules the formatter follows
- Each object property and array element goes on its own line, indented one level deeper than its parent.
- Empty objects and arrays stay on one line as {} and [].
- Indentation uses spaces only; tabs are not offered. Pick 2 spaces for compact output or 4 for clearer separation between levels.