JSON Formatter & Validator
Paste JSON to pretty-print it with clean indentation, minify it to a single line, or just check whether it is valid — with clear error messages when it is not.
Result
How It Works
JSON (JavaScript Object Notation) is the standard format for data sent between web services, but API responses usually arrive as one long unbroken line that is almost impossible to read. This formatter parses your JSON and reprints it with clean indentation, so nested objects and arrays open up into a readable tree. Minify works the other way, squeezing formatted JSON back to a single compact line for pasting into a URL, a database field or a message.
Validation is built in. If your JSON has a syntax problem — a trailing comma, a missing quote, an unclosed bracket — the tool shows the exact error instead of failing silently, so you can find and fix the mistake. Parsing runs entirely in your browser, so your data never leaves your device and the result matches what your own code would produce.
Worked Example
Paste {"name":"Ava","age":30,"city":"Austin"} and press Format with 2-space indent. The output is:
{
"name": "Ava",
"age": 30,
"city": "Austin"
}
Minify collapses it back to the single line {"name":"Ava","age":30,"city":"Austin"}. Paste {"name": "Ava",} — with a trailing comma — and the tool reports an error instead, because trailing commas are not allowed in JSON.
How to Use This Tool
Paste your JSON into the box, choose 2 or 4 spaces for the indent, then press Format to pretty-print it, Minify to compress it, or Validate to check it without changing anything. The result appears below with a summary of the top-level type, the number of keys or items, and the nesting depth. Use Copy Output to copy the result, or Load Sample to try a ready-made example.
Tips and Practical Advice
- Fix the first error first. A single missing quote can make everything after it look wrong — correct the earliest error, then validate again.
- Watch for trailing commas. They are legal in JavaScript objects but forbidden in JSON, and they are the most common reason a config file fails to parse.
- Use 2 spaces for reading, 4 for deep data. Two-space indent keeps wide objects compact; four spaces makes deeply nested structures easier to follow.
- Minify before pasting into tight spaces. A single-line JSON string fits in URL parameters, chat messages and single-line form fields without breaking.
Last updated: