JSON Formatter & Validator
Paste messy or minified JSON to get it cleanly indented — or minify it back to one line. Invalid JSON gets a clear error so you can find the problem fast. Everything runs locally in your browser.
How to use this calculator
- Paste your JSON into the box.
- Choose Beautify (with your preferred indent) or Minify.
- Press Format. If the JSON is invalid, the error points you to the line and column.
Formula used
The tool parses your input into a real data structure (catching any syntax error), then re-serializes it. That round-trip guarantees the output is valid and also normalizes it — consistent quoting, no trailing commas, standard escaping.
Example calculation
Minified input {"name":"Nexify","active":true} beautifies to a clean two-line, indented object.
A stray trailing comma or single-quoted key triggers a precise error like "Invalid JSON (around line 3, column 12)" — turning a frustrating hunt into a direct fix.
Why a formatter earns its keep
JSON is strict where humans are loose: double quotes only, no trailing commas, no comments, no single quotes. Most "broken" JSON fails on exactly these, and API responses arrive minified into an unreadable wall. A formatter solves both — validating against the strict rules while pretty-printing the structure so you can actually read a nested payload.
The parse-and-reserialize approach is also a normalizer: it standardizes escaping and key quoting, so pasting hand-edited config through it produces canonical JSON you can trust. And because it runs locally, you can safely format responses containing tokens or private data.
Why use this calculator?
- Turn minified API responses into readable, indented structures.
- Validate JSON with error locations instead of a vague "parse failed".
- Minify for production, or normalize hand-edited config to canonical form.
Frequently asked questions
Why is my JSON invalid?
The usual culprits: trailing commas after the last item, single quotes instead of double, unquoted keys, comments (JSON allows none), or a missing bracket. The error message here points to the line and column so you can spot it fast.
Does minifying JSON change the data?
No — it only removes whitespace between tokens. The parsed data is identical; the file is just smaller for transmission. Beautifying and minifying are lossless round-trips of each other.
Can JSON have comments?
Standard JSON cannot — that's a deliberate design choice. Variants like JSONC or JSON5 allow comments, but strict parsers (and this validator) reject them. For config files needing comments, use YAML or a commented superset.