Free online JSON beautifier. Paste JSON to format with indentation, validate with exact error line, minify for production, or view as an interactive tree.
This free JSON beautifier formats unreadable or compact JSON into properly indented, human-readable output. It also validates JSON syntax and reports the exact line and column of any error — making it easier to debug malformed JSON from APIs, configuration files, or log output.
Adds consistent indentation and line breaks. Choose 2 spaces, 4 spaces, or tab indentation. Output is ready to copy into your editor or documentation.
Strict JSON validation with exact error position. Shows the line number and column where the syntax breaks — single quotes, trailing commas, unquoted keys.
Removes all whitespace and newlines to produce compact JSON for API responses, storage, and transmission. Shows size reduction percentage.
Why does my JSON have a syntax error on line 1?
A line 1 error usually means the JSON starts with an unexpected character — often a BOM (byte order mark) invisible in some editors, a leading space before the opening brace, or the content isn't JSON at all (HTML error page, XML, or plain text). Copy-paste from some tools adds invisible characters. Try typing the JSON manually or use the Sample button to see well-formed JSON.
Can JSON have comments?
No. The JSON specification does not support comments. // comment and /* comment */ are not valid JSON and will cause parse errors. If you need comments in configuration files, consider JSONC (JSON with Comments, used by VS Code), JSON5, or YAML instead. Some tools like Node.js JSON.parse will throw on commented JSON — strip comments before parsing.
What is the difference between JSON and JavaScript objects?
JSON is a text format — all keys must be double-quoted strings, values can only be strings, numbers, booleans, null, arrays, or objects. JavaScript objects allow unquoted keys, single quotes, trailing commas, undefined, functions, and Date objects. JSON is a strict subset of JavaScript literal syntax, but not identical. JSON.parse rejects valid JavaScript object syntax that isn't valid JSON.