JSON Formatter & Validator
By Stuart Mathieson · Updated October 2026
Tips:
- Paste minified or unformatted JSON to validate and beautify it
- Use Minify to compress formatted JSON
- Errors will be highlighted with their location
How the JSON formatter works
The formatter reads your text with the browser's built-in JSON parser, which follows the JSON standard (RFC 8259). If it parses, the data is written back out either indented with 2 spaces (Format) or with all optional whitespace removed (Minify). Because the output is rebuilt from the parsed data, it is always valid JSON.
Example
This minified input:
{"name":"Ada","skills":["math","code"],"active":true}
formats as:
{
"name": "Ada",
"skills": [
"math",
"code"
],
"active": true
}
Common errors and how to fix them
| Problem | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | {"a": 1} // note | {"a": 1} |
| NaN or undefined | {"a": NaN} | {"a": null} |
Things to know
- Large numbers. JavaScript can only represent whole numbers exactly up to 9,007,199,254,740,991 (253 − 1). Larger values are rounded - 9007199254740993 becomes 9007199254740992 - and the formatter warns you when this happens. Store large IDs as strings to keep them intact.
- Duplicate keys. If a key appears twice in the same object, only the last value is kept.
- Key order. Keys keep their order, except that keys which are whole numbers (such as "1" or "42") move to the front in numeric order - a JavaScript rule.
Frequently asked questions
What happens if my JSON is invalid?
You'll see the specific parsing error, which usually points to the exact issue - a trailing comma, missing quote, or unmatched bracket, for example.
What's the difference between format and minify?
Format adds indentation and line breaks so the JSON is easy to read. Minify strips all unnecessary whitespace to make the payload as small as possible - useful before sending data over a network.
Does this send my data anywhere?
No - parsing and formatting happen entirely in your browser using JavaScript's built-in JSON support. Nothing is uploaded or logged.
Can JSON contain comments?
No. The JSON standard doesn't allow comments, so remove them before formatting. Some tools accept variants such as JSONC for configuration files, but standard JSON parsers reject them.
Sources
- RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format - Internet Engineering Task Force
- Number.MAX_SAFE_INTEGER - MDN Web Docs