JSON Formatter & Validator
Format, validate, and beautify JSON instantly. Catch syntax errors, pretty-print nested objects, or minify for APIs — all in your browser.
💡 Tip: Click on any tree node to expand/collapse. Hover to copy JSON path.
JSON vs object literals vs JSON5
This formatter validates and pretty-prints strict JSON (ECMA-404 / RFC 8259). It is not a JavaScript evaluator.
// Valid JS object literal — INVALID JSON
{ name: 'Ada', trailing: true, }
// Valid JSON
{ "name": "Ada", "trailing": true }
// JSON5 (not supported here) allows comments, single quotes, trailing commasReading real parser errors
Engines report position-based messages. Typical causes:
Unexpected token '— single-quoted stringUnexpected tokenbefore}— trailing comma- Unterminated string — missing closing quote or raw newline inside a string (use
\n)
{"ok": true,}
// → SyntaxError near the trailing comma
{"n": 9007199254740993}
// → parses, but n may become 9007199254740992 in JS NumberFormat vs minify
Format inserts whitespace for humans. Minify removes insignificant whitespace for smaller request bodies. Neither changes the data model — unless a number already lost precision at parse time.
Frequently Asked Questions
Why does my browser console accept this but the formatter rejects it?
The console evaluates JavaScript. JSON is stricter: double-quoted keys, no trailing commas, no undefined, no comments. What works as an object literal is often invalid JSON.
Why did a large integer change after formatting?
JSON.parse uses IEEE-754 numbers. Integers outside Number.MAX_SAFE_INTEGER (±2^53−1) lose precision. Keep big IDs as strings if exact digits matter.
What does “Unexpected token” usually mean?
Often a single quote instead of double quotes, a trailing comma after the last property, or a bare word like undefined/NaN that JSON does not allow.