How validation works
The text is parsed with the browser's own JSON.parse, the same strict parser your JavaScript code uses. If parsing succeeds, the value is printed again with JSON.stringify using the indent you choose, or with no whitespace at all when you minify. If it fails, the error position is converted to a line and column so you can jump straight to the problem.
Common JSON errors and how to fix them
| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a":1,} | Remove the comma after the last item |
| Single quotes | {'a':1} | JSON strings and keys need double quotes |
| Unquoted key | {a:1} | Write {"a":1} |
| Comments | // note | JSON has no comments; remove them |
| NaN / undefined | {"a":NaN} | Use null or a number |
| Raw newline in string | "line1⏎line2" | Escape it as \n |
| Leading zero | {"n":007} | Numbers cannot start with 0 unless they are 0 |
Worked example
The minified input {"id":7,"tags":["a","b"]} formats with 2-space indent to:
{
"id": 7,
"tags": [
"a",
"b"
]
}Minifying reverses it and saves every byte of whitespace, which matters for API payloads and config embedded in URLs.
JSON data types
JSON supports exactly six types: string, number, boolean (true/false), null, array and object. Dates have no native type; they are usually stored as ISO 8601 strings such as "2026-11-26T09:30:00Z" or as Unix timestamps.
What "valid" means
Valid means the text conforms to RFC 8259, the JSON standard. It does not check a schema: {"age":"ten"} is valid JSON even if your app expects a number.