JSON Formatter & Validator: The Complete Guide
JSON is everywhere and it only takes one stray comma to break everything. Learn the rules, the common errors, and how to format and validate JSON instantly.
What JSON is
JSON (JavaScript Object Notation) is a text format for structured data. It is human-readable and machine-parseable, which is why APIs, configuration files and logs rely on it.
{
"name": "Ada",
"roles": ["admin", "editor"],
"active": true,
"score": 42,
"meta": null
}
Format, validate and minify JSON with the free JSON formatter.
The rules that make JSON valid
- Data is key/value pairs (
"key": value) in objects. - Strings use double quotes. Single quotes are invalid.
- No trailing commas anywhere.
- Keys must be double-quoted strings.
- Numbers, booleans (
true/false) andnullare the other value types. - A document has one root value (usually an object or array).
The errors that break parsers
- Trailing commas.
- Single quotes instead of double quotes.
- Unquoted keys.
- Comments (not allowed in standard JSON).
- Missing or extra brackets and braces.
- Unescaped control characters and quotes inside strings.
NaNorInfinity(not valid JSON).
A validator points to the exact line, which turns a frustrating hunt into a two-second fix.
Format vs minify
- Format (pretty-print) adds indentation and line breaks for humans.
- Minify strips all unnecessary whitespace for transport.
Use formatted JSON in files you edit; minified JSON in production payloads to save bandwidth.
JSON vs JavaScript objects
They look similar but differ: JSON keys must be quoted, strings must use double quotes, and values cannot be functions or undefined. Copying a JavaScript object literal into JSON often fails for those reasons.
Working with JSON safely
- Validate before deploying config changes.
- Never
eval()JSON — use a parser. - Keep payloads small by minifying.
- Watch for deep nesting, which hurts readability and performance.
Convert and format free
Paste your JSON into the formatter, get instant validation and pretty-printing, then convert to CSV with the JSON to CSV tool when you need a spreadsheet. Everything runs in your browser.