Check JSON and find the exact line of the error
Paste JSON to check it. Valid JSON is confirmed with its size and value count; JSON that isn’t valid shows where it breaks and why.
How to use it
Paste the JSON you want to check, or open a file. The check runs as you paste: the status bar says Valid JSON, or Not valid JSON with the line and column. Read the reason and the lines around it, then press Show in input to put the cursor on the spot. Fix it and the check runs again as you type. Checking JSONC or JSON5? Pick it above the editor: that standard’s comments, trailing commas and other forms are then allowed, and the result is shown as JSON.
Examples
Missing comma
{
"name": "api"
"port": 8080
}Line 3, column 3Expected "," or "}" but found the string "port"
The error points at the start of the line after the missing comma.
Trailing comma
{"items": [1, 2, 3,]}Line 1, column 19Trailing comma before "]" is not allowed in JSON
Python-style literal
{"enabled": True}Line 1, column 13"True" is not valid JSON; use true, false or null
Common JSON errors and how to fix them
Expected "," or "}" but found the string "port": a comma is missing between two properties. Add one at the end of the line before. Trailing comma before "]" is not allowed in JSON: there is a comma after the last item, as in [1, 2, 3,]. Delete it. Expected a property name in double quotes but found "'": a key in single quotes or with no quotes. Write "name", not 'name' or name. Comments are not allowed in JSON: // and /* */ belong to JSONC and JSON5, not JSON. Remove them. "True" is not valid JSON; use true, false or null: Python’s True, False and None, and JavaScript’s NaN and undefined, are not JSON. Use true, false or null. Line break inside a string; use \n instead: a string can’t run over two lines. Write \n where the break should be. Invalid number "00": a number can’t start with a zero, as in 007. Write 7, or "007" as a string. Unexpected "{" after the end of the JSON value: two documents were pasted together. Put them in an array, or check one at a time. Expected a property name in double quotes but found "“": curly quotes, which word processors and chat apps put in. Replace them with straight " quotes. Expected a value but found U+00A0 (a space JSON doesn’t allow: only space, tab, CR and LF): a non-breaking space, often copied from a web page or a document. Replace it with a plain space.
What the validator checks
Sources: RFC 8259: The JSON Data Interchange Format, The JSON5 Data Interchange Format 1.0.0
Questions
- Is my JSON uploaded?
No. Everything runs in your browser, so your JSON stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. That matters when you check an API response or a config file that holds keys. - Why does it show only one error?
After the first error the parser can’t tell what was meant, so further messages would mostly be wrong. Fix the first one and the check runs again. - Is JSON with comments valid?
Not as JSON: standard JSON has no comments. JSONC (used by VS Code settings) and JSON5 allow them, and they are different formats. Pick JSONC or JSON5 above the editor to check a file in that format; with JSON picked, an error in text that one of them reads says which. - Are duplicate keys an error?
No. The standard says keys should be unique but doesn’t make duplicates invalid, so the validator accepts them. JavaScript’s JSON.parse and Python’s json module keep only the last value, so it is worth removing them. - Can it fix my JSON for me?
The validator doesn’t change your text: it names the first error and puts the cursor on it. The JSON Formatter ’s Repair switch does fix it: quotes, commas, comments, unquoted keys and Python values, with every change listed by line. - Does it check fields against a JSON Schema?
No. It checks that the text is well-formed JSON, not that it has the fields or types an API expects. For that, use the JSON Schema validator .