JSON Formatter & Validator
Format, beautify, and validate JSON online. Free JSON formatter with syntax error detection - pretty print or minify JSON.
Three steps to get started
Paste your JSON
Paste or type your JSON into the input area. Errors will be highlighted immediately.
Choose format or minify
Click "Format / Beautify" to pretty-print your JSON with your chosen indent size, or "Minify" to compress it.
Copy the result
Click Copy to copy the formatted or minified JSON to your clipboard, ready to use.
JSON formatting and validation explained
JSON (JavaScript Object Notation) is a text format for structured data, specified identically by RFC 8259 and ECMA-404. It permits exactly six value types: object, array, string, number, boolean, and null. A formatter takes valid JSON and re-emits it with consistent indentation; a validator tells you why the parser rejected it. This tool does both, and the important consequence is that formatting a document is also a proof that it parses.
Validation runs through the browser's native JSON.parse() - the same engine your application uses - so anything accepted here is accepted by your Node.js server, and anything rejected here would have thrown there too. There is no lenient fallback mode, which is the point.
Why is my JSON invalid? The usual suspects
Nearly every parse failure is one of these, and most stem from assuming JSON is a subset of JavaScript literal syntax. It is stricter:
- Trailing comma:
{"a": 1,}is legal in modern JavaScript and illegal in JSON. The most common single cause. - Single quotes:
{'a': 1}fails. JSON strings require double quotes, always. - Unquoted keys:
{a: 1}fails. Object member names are strings, not bare identifiers. - Comments:
//and/* */are not part of the spec. Formats like JSONC and JSON5 add them; plain JSON does not. - Non-finite numbers:
NaN,Infinity, and-Infinityhave no JSON representation. Leading zeros and a bare.5are rejected too - write0.5. - Smart quotes: Copying from a document or chat client can substitute curly quotation marks that look correct but are different codepoints entirely.
Pretty-print or minify?
Both operations preserve the data and change only whitespace between tokens. Pretty-printing rebuilds the document via JSON.stringify() at your chosen indent - 2 spaces (the JavaScript and npm convention), 4 spaces (common in Python and Java codebases), or tabs. Minifying strips every optional space and newline, typically cutting 10–30% off an indented payload and giving you what belongs in an HTTP body, a database column, or an inline <script> block.
Two things formatting will quietly do to you: duplicate keys collapse to the last value (the spec leaves this undefined and JavaScript picks last-wins), and integers beyond Number.MAX_SAFE_INTEGER - snowflake IDs are the classic example - lose precision on round-trip, so keep those as strings.
Parsing and re-serialization both happen locally in your browser tab, so production API responses and customer records can be pasted here without crossing a network boundary.