JSON Formatter & Validator
Format, minify and validate JSON instantly.
Paste JSON below to pretty-print, minify or validate it. Errors include the line and column number. The parser is the native JSON parser, so behaviour matches your runtime exactly.
How to use it
Paste your JSON
Drop your API response, config file or webhook payload into the input panel.
Pick a transformation
Format pretty-prints with 2 or 4 spaces; Minify strips all optional whitespace.
Read errors or copy the output
If the JSON is invalid, the line and column number of the first problem are shown. Otherwise, copy the formatted output.
What is it?
A JSON formatter pretty-prints, minifies or validates JSON. Pretty-printing re-indents the data so a human can read it; minifying strips every byte that isn't structurally required, ideal for embedding in URLs or shrinking API payloads; validating catches the trailing commas, single quotes and stray comments that strict JSON parsers reject. Because the parser used here is the browser's native JSON.parse(), behaviour matches your runtime exactly.
When to use it
Whenever you're debugging an API response, reviewing a config file, preparing a fixture for a test, or trying to figure out why a third-party webhook is being rejected. Minifying is useful when you're embedding JSON in a query string or a JWT claim. Validating is the first move when 'invalid JSON' is in a stack trace and you can't tell which character is the problem.
Common mistakes
JSON looks like JavaScript object literals but isn't: keys must be in double quotes, no trailing commas, no comments, and no single quotes for strings. NaN, Infinity and undefined are not valid values. Dates and BigInts need to be serialised as strings. And remember a top-level JSON document can be any value, not just an object - `42`, `true`, `null` and `[]` are all valid JSON.
FAQ
- Is my JSON sent to a server?
- No. Formatting and validation happen in your browser only.
- Why is my JSON invalid?
- Common causes: trailing commas, single quotes around strings, unquoted keys, comments. None are valid in strict JSON.
Related tools
More in this category
- Base64 Encoder / Decoder
- URL Encoder / Decoder
- Hash Generator (SHA-1, SHA-256, SHA-384, SHA-512)
- JWT Decoder
- Regex Tester
- Markdown to HTML Converter
- YAML to JSON Converter
- CSV to JSON Converter
- SQL Formatter
- HTML Entity Encoder / Decoder
- Cron Expression Reader
- XML Formatter
- HTML Minifier
- Mock Data Generator
- Markdown Table Generator