Find the exact line that breaks your JSON
JSON Validator
Paste JSON or open a .json file to check whether it is valid. If it is not, you see the line and column of the error, what usually causes it and how to fix it. Validation runs in your browser, so private data stays private.
Invalid JSON at line 6, column 1
Trailing comma. Remove the comma before this closing bracket; JSON does not allow a comma after the last item.
Parser message: Expected double-quoted property name in JSON at position 101 (line 6 column 1)
102 B6 linesProcessed in your browser
What does a JSON validator check?
A JSON validator checks that text follows the JSON syntax rules in RFC 8259 and ECMA-404: double-quoted keys and strings, commas between items, matching brackets, and only the values JSON allows. If a single character is wrong, an API, config loader or JSON.parse call will reject the whole document.
This validator parses your text on every edit. When it finds a problem it reports the first error's line and column, highlights it in the editor, and translates the parser's message into a plain explanation such as "Trailing comma" or "Single quotes are not valid in JSON". The example in the editor has a trailing comma so you can see how it works.
How to validate JSON
- 1
Add the JSON
Paste it into the editor or press Open file to check a .json file. The example already contains an error to show the output.
- 2
Read the result
The status turns green for valid JSON. Otherwise you see the line, column, parser message and a suggested fix.
- 3
Jump to the error
Press Go to error to put the cursor on the problem. Fix it, and the result updates as you type.
- 4
Repeat until valid
Parsers stop at the first error, so fix one at a time until the status says Valid JSON.
Common JSON syntax errors and how to fix them
Most invalid JSON comes from a handful of mistakes, usually because the text was written as a JavaScript object or edited by hand. The validator explains each of these in plain English next to the line and column.
| Error | Invalid example | Fix |
|---|---|---|
| Trailing comma | {"a": 1, "b": 2,} | Delete the comma after the last item |
| Single quotes | {'name': 'Ada'} | Use double quotes for keys and strings |
| Unquoted key | {name: "Ada"} | Wrap every property name in double quotes |
| Missing comma | {"a": 1 "b": 2} | Add a comma between properties or array items |
| Comment | {"a": 1 // note} | Remove // and /* */ comments |
| Unescaped line break | "line one↵line two" | Write the break as \n inside the string |
| Invalid value | {"a": undefined} | Use null, a number, a string or a boolean |
| Unclosed bracket | {"items": [1, 2} | Close every [ with ] and every { with } |
What JSON.parse error messages mean
Browsers and runtimes word their errors differently. These are the messages you are most likely to see from Chrome, Node.js, Firefox and Safari, and what they mean.
| Message | Usually means |
|---|---|
| Expected double-quoted property name | A trailing comma before } or an unquoted or single-quoted key |
| Unexpected token ' in JSON | Single quotes used instead of double quotes |
| Expected ',' or '}' after property value | A missing comma between two properties |
| Unexpected end of JSON input | A missing closing bracket or quote, or an empty response |
| Unexpected non-whitespace character after JSON | Two JSON values in one document, or an extra bracket |
| Bad control character in string literal | A raw line break or tab inside a string |
| Unexpected token < in JSON at position 0 | The response is HTML (often an error page), not JSON |
JSON syntax rules in one minute
- A JSON document is one value: an object {}, an array [], a string, a number, true, false or null.
- Property names and strings use double quotes. Single quotes are not allowed.
- Items in objects and arrays are separated by commas, with no comma after the last item.
- Numbers are written in decimal without leading zeros, quotes or a trailing dot. NaN and Infinity are not valid.
- Comments are not part of JSON. Formats such as JSONC and JSON5 allow them, but strict parsers reject them.
- Whitespace between tokens is ignored, which is why formatting and minifying do not change the data.
Syntax validation vs JSON Schema validation
Valid syntax means the text can be parsed. It does not mean the data is what your application expects. JSON Schema validation is a separate step that checks required fields, types, formats and allowed values against a schema document. This page checks syntax only, which is the step every JSON document must pass first.
JSON Validator FAQ
How do I know if my JSON is valid?
Paste it into the editor. If the status says Valid JSON, any standard JSON parser will accept it. If not, the line and column of the first error are shown with an explanation.
Why does my JavaScript object fail JSON validation?
JavaScript allows unquoted keys, single quotes, trailing commas, comments and undefined. JSON allows none of these. Convert keys and strings to double quotes and remove the rest.
Why do I get "Unexpected token < in JSON at position 0"?
The text starts with <, which means you received HTML instead of JSON. That usually happens when a server returns an error page or a login page. Check the request URL and status code.
Does it show all errors at once?
JSON parsers stop at the first error, so the validator reports one at a time. Fix it and the next one, if any, appears immediately.
Can I validate a large JSON file?
Yes. Open the file with Open file or drag it onto the editor. Files of several megabytes validate in a fraction of a second on most devices. Files over 60 MB are refused to keep the tab responsive.
Does this validate JSON Schema?
No. It checks syntax only. It does not check required properties, types or other rules from a JSON Schema.
Will the validator fix my JSON automatically?
No. It explains each error so you stay in control of your data. Once the JSON is valid, you can format or minify it with one click.