data / PRACTICAL GUIDE
What Does JSON Formatting Do?
Make structured data easier to inspect while keeping its keys, strings, and numeric tokens intact.
JSON formatting adds indentation and line breaks around the data so you can follow objects and arrays. It does not fix incorrect values or change spaces inside strings. Minification removes that optional whitespace; validation checks whether the text follows JSON grammar.
THE IDEA, VISUALLY
Same data, easier to read
- {"name":"Ada","age":36}
- Indentation + line breaks
- Keys and values stay the same
Whitespace reveals structure
JSON formatting inserts indentation and line breaks between tokens. It makes nested objects and arrays easier to follow. It does not change the intended data or correct an incorrect value.
For example, separating an array across lines makes missing entries easier to spot. Minification does the reverse by removing unnecessary whitespace outside strings.
References: RFC 8259: JSON grammar
Read the nesting
The following object has an order containing a numeric identifier and an items array. The same data can appear on one line; indentation makes the containment easier to scan.
The large identifier is intentional. A formatter that parses into JavaScript numbers and serializes again could round it. Edit All preserves the original number token.
{
"order": {
"id": 9007199254740993,
"items": [
"book",
"pen"
]
}
}Know what must remain untouched
Whitespace inside quoted strings is data. The value "New York" must not become "NewYork" when minified. Escaped characters also need to remain properly encoded.
The formatter first validates syntax and then rewrites whitespace outside strings. It preserves the original key order and numeric spelling.
- Paste a complete JSON value or open a JSON file.
- Choose Format JSON and inspect nesting with two or four spaces.
- Use Minify when you need a compact copy; whitespace inside strings remains.
- Copy or download the result. An error requires an input correction before a result is produced.
Formatting is not repair
A trailing comma or unquoted key prevents valid formatting. Read the reported location, inspect the preceding token, and correct the intended syntax. For application-specific requirements, use a schema validator or the application’s own checks.
Distinguish formatting, syntax validation, and schema checks
Frequently asked questions
Does formatting sort the keys?
Edit All keeps the input key order. Formatting alone does not define a sorting rule or make a canonical representation for signing or hashing.
Does Minify remove spaces from text values?
No. The string “New York” keeps its space. Only optional whitespace outside quoted strings is removed.