GintiCalcEvery calculation

JSONPretty

JSON Formatter & Validator

Paste JSON — pretty-print it, minify it, or get a clear syntax error showing what went wrong.

Common JSON syntax errors and what causes them

JSON is far stricter than JavaScript object literals. These are the errors that account for most parse failures.

Error messageCauseFix
Unexpected token } in JSONTrailing comma after the last itemRemove the comma before } or ]
Unexpected token ' in JSONSingle-quoted stringsJSON requires double quotes
Unexpected token n in JSONUnquoted key, or a stray NaNQuote every key; NaN is not valid JSON
Unexpected end of JSON inputTruncated data or an unclosed bracketCheck every { and [ has a partner
Unexpected token in JSON at position 0Empty body, or HTML returned instead of JSONCheck the response is actually JSON
Bad control character in stringA literal newline or tab inside a stringEscape them as backslash-n and backslash-t

JSON has no comments, no trailing commas, no single quotes, and no undefined or NaN values. Keys must always be double-quoted strings.

Strict JSON rules

Keys must be double-quoted strings. No trailing commas. No comments. No single quotes. JavaScript object literals are not JSON — `JSON.parse` rejects them.

Frequently asked questions

My API response is one long line — how do I read it?

Paste the minified JSON into this formatter and it will pretty-print it with proper indentation. Most APIs return compact JSON to save bandwidth, which is valid but unreadable without formatting.

What's the difference between JSON and a JavaScript object?

JSON requires double-quoted keys, no trailing commas, no comments, and no undefined values. A JavaScript object literal allows all of those. JSON.parse() rejects anything that isn't strict JSON.

Why does my JSON have a 'trailing comma' error?

JSON does not allow a comma after the last item in an array or object. While JavaScript tolerates trailing commas, JSON strictly forbids them. Remove the comma before any closing ] or }.

Is there a size limit for JSON files?

The JSON specification has no size limit, but practical limits come from the parser. Browsers typically handle up to ~500 MB, and most API gateways cap request bodies at 1-10 MB.

Related Developer calculators

You might also like

Last updated: September 7, 2026