What a JSON formatter actually does
JSON (JavaScript Object Notation) is the lingua franca of the modern web — every REST API, config file and front-end state blob speaks it. But the JSON that travels between machines is usually minified: stripped of whitespace to save bandwidth, and almost impossible to read. A formatter parses that text into a real data structure and prints it back out with consistent indentation, so you can scan keys, spot the shape of nested objects, and catch mistakes at a glance.
Just as importantly, parsing is a validation step. If your JSON has a syntax error, it can’t be parsed — and this tool tells you exactly where it broke instead of failing silently inside your application.
The mistakes that break JSON
JSON parsers are deliberately strict. These four issues account for most “invalid JSON” errors:
- Single quotes. Strings and keys must use double quotes.
{'name': 'Ada'}is invalid;{"name": "Ada"}is correct. - Trailing commas.
[1, 2, 3,]fails — remove the comma after the final item. - Unquoted keys.
{age: 36}is a JavaScript object, not JSON. Every key needs double quotes. - Comments. JSON has no comment syntax. Strip
//and/* */before parsing.
The six JSON data types
| Type | Example |
|---|---|
| String | "hello" |
| Number | 36, -2.5, 1e3 |
| Boolean | true / false |
| Null | null |
| Array | [1, 2, 3] |
| Object | {"k": "v"} |