JSON Validator and Syntax Checker
FV-04Paste JSON and press Validate. A valid document gets a one-line report. An invalid one gets the line and column of the first error and, for common mistakes, a hint about the cause. It all runs in your browser.
Runs in your browser. Nothing is uploaded.
JSON
Formatted JSON (if valid)
How to use it
- Paste your JSON into the input box, or open a .json file (up to 5 MB) or drop it on the box.
- Press Validate. The result updates as you type.
- If the JSON is valid, read the report: its type, how many values it holds, how deeply it nests, and any warnings.
- If it is not valid, read the message and press Go to error to select that spot in your text.
- Press Format if valid to see the same document indented with 2 spaces, 4 spaces or a tab.
What a valid result tells you
A valid document returns Valid JSON and what it holds, such as an object with 5 keys, plus the number of values, the nesting depth and the length in characters. It also raises two warnings that many parsers stay quiet about. A key repeated inside one object is allowed by the syntax, but parsers keep only the last value, so the earlier ones vanish. A number with more digits than a JavaScript number can hold, such as 12345678901234567890, is valid JSON, but JSON.parse in JavaScript would round it.
Reading the error and the hint
The check follows the JSON standard, RFC 8259, and stops at the first error. The message gives the line and column where parsing failed. For the usual causes it adds a hint: single quotes, comments, a comma before a closing bracket, NaN or undefined, an unquoted key, a missing comma, a byte order mark at the start, or text after the first value. The position is where the parser gave up, which can be just after the real mistake, so look at the characters before it as well.
What it does not check
This checks syntax only. It does not test your data against a JSON Schema, so a document can be valid here and still be refused by the API that reads it because a key is missing or a value has the wrong type. It reads one value per document, so a JSON Lines file with one object per line is reported as an error after the first object. Comments and trailing commas are errors because they are not part of JSON.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
Expected a string key | Inside an object the parser wanted a key in double quotes and found something else: a single quote, a bare word, or a closing brace right after a comma. | Put the key in double quotes, or delete the comma before the closing brace. |
Expected ',' or '}' | An object member ended and the next character is neither a comma nor the closing brace. A comma is often missing, or a comment follows the value. Arrays give the same message with ']'. | Add the comma between the members, or remove the comment. |
Unexpected character | A character that cannot start a value, such as NaN, undefined or a single quote, or a stray letter. | Use null, a number, true, false or a string in double quotes. |
Unterminated string | A string was opened with a double quote and never closed. | Add the closing quote, and write any double quote inside the string as \". |
Unexpected end of input | The text ended while a value, a key or a bracket was still open. | Add the missing value, closing brace or closing bracket. |
Unexpected data after the end of the JSON value | One complete value was read and more text follows it. | Keep one JSON value. Wrap several objects in an array, or check each line of a JSON Lines file on its own. |
Questions people ask
How do I validate JSON online?
Paste the JSON into the input box and press Validate. A valid document returns Valid JSON and a short report. An invalid one returns the first error with its line and column. It runs in your browser, and nothing is sent to a server.
Why is my JSON invalid?
The usual causes are single quotes instead of double quotes, a comma after the last item, comments, an unquoted key, a missing comma between items, and values such as NaN or undefined. The error shows the position and, for these cases, a hint.
Can JSON have comments or trailing commas?
No. Standard JSON allows neither, so both are reported as errors. Formats such as JSON5 allow them. If your file comes from a tool that accepts comments, remove them first or convert the file to strict JSON.
How do I find the line of a JSON error?
Read the line and column at the end of the message, then press Go to error to select that character in the input box. Check the text just before it too, because the parser reports where it gave up, which can be a little after the mistake.
Why does the validator warn about a duplicate key?
JSON syntax does not forbid a repeated key, but most parsers keep only the last value and silently drop the others. The warning names the first repeated key and where it sits, so you can decide which value you meant.
Does this check my JSON against a schema?
No. It checks syntax only, meaning that the text is well-formed JSON. It does not know which keys or types your application expects. Use a schema validator for that, for example with the schema a generator builds from a sample.
About this tool
Checks the text against the JSON standard (RFC 8259) and reports the line and column of the first error, with a hint when it is one of the usual causes such as single quotes, comments or a trailing comma. Valid JSON also gets two warnings that a plain parser would hide: duplicate keys in one object (parsers keep only the last) and numbers that JavaScript would round. It does not check data against a schema, and only the first error is reported.