JSON Formatter
Paste JSON to pretty-print, minify and validate it - with the exact line and column of any error. Nothing leaves your browser.
Format, validate and minify JSON
JSON (JavaScript Object Notation) is the format nearly every web API speaks in, but a raw response arrives as one dense, unreadable line. Paste it above and hit Format to get clean, indented output you can actually scan. Prefer a compact payload for a request body or a config value? Minify strips every optional space and newline while keeping the data identical.
Every time you type, the tool parses your input with the browser's own JSON engine. If it is valid you get a green tick and a count of the top-level keys; if not, you get the precise line and column of the first problem, plus a caret pointing at the offending character. That is usually far faster than squinting at a wall of brackets.
Reading a JSON error
Most invalid JSON fails for one of a handful of reasons. Keys and strings must use double
quotes, never single quotes or none at all. There is no trailing comma allowed after the last
element of an array or object. Every string, array and object must be properly closed. And
special characters inside strings - quotes, backslashes, newlines - have to be escaped. When
the error reads Unexpected token } in JSON at position 42, position 42 is the
character index the parser choked on, which the caret preview above turns into a visible spot.
Two-space, four-space or tabs
Indentation is purely cosmetic - all three produce byte-for-byte equivalent data. Two spaces
is the most common default (it is what package.json and most style guides use),
four spaces reads well for deeply nested structures, and tabs let each viewer set their own
width. Pick whatever matches the file you are pasting back into.
Working with other developer formats? Try the Base64 encoder for encoding payloads, the JWT decoder to inspect tokens whose payload is itself JSON, or the URL encoder when you need to pass JSON in a query string.