How to use the JSON Formatter
Raw JSON is unreadable when it's all on one line; pretty-printed JSON is easy to scan. The formatter handles both directions plus catches syntax errors before they hit production.
Paste your JSON
Drop in any JSON — API responses, config files, schema markup, log entries. The formatter parses and re-serializes.
Pick the format mode
Pretty-print for human reading (2 or 4 space indent). Minify for shipping — strips all whitespace, smallest payload.
Review syntax errors
If the JSON is invalid, the formatter shows the line and column of the error plus the offending character. Most errors are trailing commas, smart quotes, or unclosed brackets.
Copy the result
Pretty-printed for docs, blog posts, or debugging. Minified for production payloads, API responses, or schema markup.
Why JSON formatting matters
JSON is the lingua franca of web APIs and structured data. A formatter is the equivalent of spell-check for code — catches syntax bugs in seconds that would otherwise take minutes to debug.
Common JSON syntax errors
- Trailing commas —
{ "a": 1, }is invalid in JSON (valid in JavaScript). - Single quotes — JSON requires double quotes around keys and string values.
- Smart quotes from doc paste — “ and ” aren't valid JSON.
- Unquoted keys —
{ a: 1 }is JavaScript, not JSON. Must be{ "a": 1 }. - Comments — JSON doesn't allow comments. Strip
//and/* */before parsing.
Pretty-print vs minify
Use pretty-print for any context where humans will read the JSON — documentation, debugging, blog post examples, README files. Use minify for production where every byte matters — API responses, schema markup in HTML, embedded config blobs.
Frequently asked questions
What does a JSON formatter do?
Two things: parses raw JSON to validate syntax and re-serializes it in a chosen format (pretty-printed with indentation, or minified with whitespace stripped). Catches malformed JSON before it hits a production parser.
Why is my JSON invalid?
Top causes: trailing commas before } or ]; single quotes instead of double quotes; smart quotes from a Word/Google Doc paste; unquoted keys (JavaScript-style); embedded comments. The formatter shows the exact line and column of the error.
When should I minify JSON?
For production payloads where size matters — API responses, schema markup embedded in HTML, large config files. Minified JSON loads and parses faster. For development and documentation, pretty-print for readability.
Are JSON and JavaScript objects the same?
No. JavaScript objects allow trailing commas, unquoted keys, single quotes, comments, and undefined values. JSON is stricter — double-quoted keys and string values, no trailing commas, no comments, no undefined. JSON is a strict subset of JavaScript object syntax.
What's the maximum JSON file size?
There's no formal limit, but parsers and APIs typically cap individual JSON payloads at a few MB. Browsers can handle multi-MB JSON in memory but the parse becomes slow. For very large datasets, use streaming JSON parsers or split into chunks.