JSON Formatter & Validator
Paste JSON or drop a .json file. It is validated as you type; everything stays in your browser.
Why format and validate JSON?
JSON (JavaScript Object Notation) is the standard data format for APIs and configuration files. API responses are usually minified into a single line — formatting (pretty-printing) adds indentation so you can read and debug them, and validation tells you exactly where invalid JSON breaks.
How to use this JSON formatter
- Paste JSON and click Beautify (or press Ctrl/⌘+Enter) to pretty-print it with 2-space indentation.
- Click Minify to strip all whitespace for smaller payloads.
- If the JSON is invalid, the error message shows what went wrong and where.
Common JSON errors and fixes
| Problem | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 'b'} | {"a": "b"} |
| Unquoted keys | {a: 1} | {"a": 1} |
| Comments | {"a": 1 // note} | Remove comments (JSON has none) |
| Special values | NaN, undefined | null or a number |
| Raw line break in a string | "line1⏎line2" | "line1\nline2" |
JSON syntax in short
Valid JSON values are: strings in double quotes, numbers, true, false, null,
arrays […] and objects {…} with double-quoted keys.
Need a different format? Convert with the YAML ↔ JSON converter.
Format JSON on the command line
jq . data.jsonpython3 -m json.tool data.json- JavaScript:
JSON.stringify(obj, null, 2)
Frequently asked questions
What does this JSON formatter do?
It pretty-prints, minifies and validates JSON in your browser, showing a clear error message when the input is not valid JSON.
Why do I get a parse error?
Most often because of a trailing comma, single quotes, unquoted keys or comments — none of these are allowed in standard JSON.
Can JSON contain comments?
No. Standard JSON (RFC 8259) does not allow comments. Formats like JSONC or JSON5 do, but they must be converted before strict parsers accept them.
What is the difference between beautify and minify?
Beautify adds line breaks and indentation for readability. Minify removes all unnecessary whitespace to make the payload as small as possible. The data itself is identical.
Is my JSON uploaded to a server?
No. Processing is fully client-side; your data never leaves the browser.