JSON Validator & Formatter
Paste your JSON to validate syntax, find errors with exact positions, and get beautifully formatted output in one click.
Need 4 spaces, tabs, minified output or sorted keys? The JSON Formatter does that in your browser and keeps every number exactly as written. To explore a large document, the JSON Viewer shows it as a tree you can search, and the JSON Compare tool shows what changed between two versions.
Instant Validation
Validate your JSON in milliseconds. Get clear error messages with exact line and column numbers to fix issues fast.
Auto Formatting
Valid JSON is automatically formatted with proper indentation. Compare input and output size side by side.
Copy & Share
Copy formatted JSON with one click. Perfect for cleaning up API responses, config files, and data payloads.
What Is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate. JSON is the most widely used format for APIs, configuration files, and data storage on the web.
A valid JSON document must follow strict syntax rules: strings must use double quotes, there are no trailing commas, keys must be quoted, and only specific value types are allowed (strings, numbers, booleans, null, arrays, and objects). Unlike JavaScript, JSON does not support comments, single quotes, or undefined values.
Because JSON syntax is strict, even a single misplaced character will make the entire document invalid. A JSON validator helps you find these issues instantly, saving time when debugging API responses, configuration files, or data exports.
Common JSON Errors
Unexpected Token
The parser stopped at a character it cannot accept there. It names the position, not the cause: the real mistake is usually a trailing comma, a single quote or an unquoted key just before it.
{"a": 1,} // Unexpected token }
{"a": 1} // validHow to fix unexpected token →Trailing Commas
JSON does not allow a comma after the last item in an array or object. [1, 2, 3,] is invalid. Remove the trailing comma.
["a", "b", "c",] // invalid ["a", "b", "c"] // validHow to fix trailing commas →
Single Quotes
JSON requires double quotes for strings and keys. Single quotes are not valid. 'hello' must be "hello".
{'name': 'John'} // invalid
{"name": "John"} // validHow to fix single quotes →Missing Quotes on Keys
All keys in JSON objects must be double-quoted strings. Unquoted keys are valid in JavaScript but not in JSON.
{name: "John"} // invalid
{"name": "John"} // validHow to fix missing quotes on keys →Missing Comma
Every pair in an object and every item in an array is separated by a comma. Leaving one out is the mirror of leaving one too many.
{"a": 1 "b": 2} // invalid
{"a": 1, "b": 2} // validHow to fix missing comma →Unclosed Bracket
Every { and [ needs its partner. The parser only notices at the end of the file, so the reported position is rarely where the mistake is.
{"a": {"b": 1} // invalid
{"a": {"b": 1}} // validHow to fix unclosed bracket →Comments
JSON does not support comments of any kind. Neither // single-line nor /* multi-line */ comments are allowed.
{
// name
"name": "John"
} // invalidHow to fix comments →Unescaped Special Characters
Strings containing backslashes, quotes, or control characters must be properly escaped with a backslash.
{"path": "C:\Users"} // invalid
{"path": "C:\\Users"} // validHow to fix unescaped special characters →Wrong Boolean/Null Casing
JSON booleans and null must be lowercase: true, false, null. True, False, None, NULL are all invalid.
{"active": True} // invalid
{"active": true} // validHow to fix wrong boolean/null casing →Browse every JSON error guide for the rest, each with the wrong and right version side by side.
Why Valid JavaScript Is Not Valid JSON
Most invalid JSON was written as a JavaScript object, or copied from a config file that allows more than JSON does. JSON is defined by RFC 8259 and is much stricter than either:
| Allowed in JavaScript | In JSON |
|---|---|
| { name: 1 } | Keys must be double-quoted strings. |
| { 'a': 'b' } | Strings use double quotes only. |
| [1, 2, 3,] | No trailing comma, in arrays or objects. |
| // a comment | No comments of any kind. JSONC and JSON5 allow them; JSON does not. |
| undefined, NaN, Infinity | Not values. JSON has strings, numbers, true, false, null, arrays and objects. |
| 0x1F, 012, .5 | Numbers are decimal, with no leading zero and a digit before the point. |
Valid JSON Can Still Lose Data
Two things pass validation and still bite later. Large integers: JSON puts no limit on numbers, but JavaScript stores them as 64-bit floats, so an id like 12345678901234567890 comes back as 12345678901234567000 once parsed. Repeated keys: RFC 8259 says names should be unique, not must, so a document with the same key twice is valid, and most parsers silently keep only the last value.
To reformat JSON without either problem, the JSON formatter prints every number and key exactly as written and reports repeated keys. When validation fails, the JSON error guides show the fix for each message, starting with the most searched one, unexpected token.