JSON looks simple until a parser rejects it. Most failures come from four habits carried over from JavaScript: a trailing comma, single quotes, an unquoted key, or a comment. A formatter makes the structure visible and points at the exact character where parsing stopped.
What you'll learn
- Pretty-print minified JSON with consistent indentation
- Read a parser error message and jump to the offending line
- Recognise the four syntax mistakes behind almost every "invalid JSON"
- Minify again before sending it over the wire
Step by step
-
Paste the JSON
Open the JSON Formatter and paste your payload into the Input pane. API responses, config blobs and log lines all work; the tool never uploads what you paste.
-
Click Format
Valid JSON is re-indented with two spaces and one key per line. Nested objects and arrays open on their own lines so the structure is obvious at a glance.
{"user":{"id":1,"name":"Ada","active":true}} → { "user": { "id": 1, "name": "Ada", "active": true } } -
Read the error if it fails
Invalid input shows the parser message with its position, line and column. "Expected double-quoted property name" right after a comma means a trailing comma; at a key it means the key is unquoted or single-quoted. Chrome and Firefox word these slightly differently, but the position is always where to look.
-
Fix and re-run
Correct the character the message points at and format again. Repeat until the output pane fills. Then use Copy Output, or Minify to strip whitespace for transport.
Common problems
Expected double-quoted property name
Reported at a closing brace, this is a trailing comma after the last property: JSON does not allow it, even though JavaScript does. Reported at a key, the key is unquoted or single-quoted; wrap it in double quotes.
Expected property name or '}'
The first key in an object is unquoted or single-quoted, or a comment sits at the start of the object. {name: "Ada"} and {'name': "Ada"} are both invalid; {"name": "Ada"} is correct.
Unexpected non-whitespace character after JSON
Something follows the closing brace: a trailing // comment, a second document pasted under the first, or a stray character. Standard JSON has no comment syntax, so remove // and /* */ blocks or keep them in a JSON5 or YAML source.
Unexpected token ' (single quote)
A string value uses single quotes. JSON strings must use double quotes: {"a": "1"}, not {"a": '1'}.
FAQ
Is my JSON uploaded when I format it?
No. Parsing and formatting run in your browser with the JavaScript engine's own JSON parser. Nothing leaves the page.
Can it format very large files?
Files of tens of megabytes work; speed depends on your device because the work happens locally. There is no server-side limit.
How do I share the formatted result with a teammate?
Copy the output and paste it into Log Share to get an expiring link with line numbers and search.