JSON Formatter
Pretty-print or minify any JSON with 2 or 4 space indentation, and validate it with exact error positions. Your JSON is parsed entirely in your browser — nothing is uploaded.
How to use
- Paste your JSON into the input box.
- Choose the indentation and click Format, Minify or Validate.
- Copy the result, or read the exact error position if the JSON is invalid.
Frequently asked questions
What is the difference between pretty and minified JSON?
Pretty-printed JSON adds line breaks and indentation so people can read and edit it comfortably. Minified JSON removes every unnecessary space and newline to shrink the file to the minimum size — the format APIs usually return. Both represent exactly the same data.
Is my JSON uploaded to a server?
No. Formatting and validation run in your browser using JSON.parse and JSON.stringify. Your data never leaves your device, which makes the tool safe for private configs and production payloads.
Why does my JSON fail with "Unexpected token"?
The usual culprits are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, comments (JSON does not allow them) or raw line breaks inside strings. The error message under the form pinpoints the exact position where parsing stopped.
What is the difference between JSON and a JavaScript object?
JSON is a strict text format: keys must be double-quoted strings and values are limited to strings, numbers, booleans, null, arrays and objects. JavaScript objects can additionally hold functions, undefined, comments and unquoted keys.