A JSON validator answers one question: is this text valid JSON, and if not, exactly where and why does it break? Our free JSON Validator checks your text as you type, shows the line and column of the first error with a marked snippet, explains the problem in plain English, and can repair the most common mistakes with one click. It is for anyone who has been handed a config file, an API sample or a copied snippet that "should work" but does not.
This guide is about finding and fixing errors. If you mainly want clean, readable output, see the companion guide on formatting and beautifying JSON.
What JSON Validator does
It reads your text with the strict rules of JSON and reports one of three states:
- Empty: a blue hint asks you to paste JSON, open a
.jsonfile or load a sample. - Valid: a green note says "Valid JSON ✓" and names the top-level type, such as "an object with 9 keys" or "an array of 20 items".
- Invalid: a red note shows "Invalid JSON", the line and column, a plain-English reason, the offending line and a caret (^) under the position.
It reports the first error it finds. After you fix that one, the next one appears, so a badly broken file may take a few rounds.
The validator checks syntax only. It does not know what your data should contain, so it cannot tell you that a field is missing or has the wrong type. A file can be perfectly valid JSON and still be wrong for your app.
How to use JSON Validator, step by step
- Open JSON Validator.
- Paste your text into "Paste or type JSON", or press Open file to load a
.jsonor text file. Broken sample loads a deliberately faulty example if you want to see how errors look. - Read the status note, which sits above the two panels so you see it first.
- If it is red, find the line and column, look at the snippet and caret, and read the reason.
- Fix the problem by hand, or press Try auto-fix if the hint under the button lists your kind of mistake.
- When the note turns green, copy or download the result from the right-hand panel. The tool opens in Tree view here, and the View switch lets you change to Text.
Validation happens automatically about 0.2 seconds after you stop typing, so there is no separate Validate button.
How to read an error message
Every error has the same parts: "line 4, column 3", a sentence, then the line itself with a ^ under the spot. If the line is long, the snippet shows about 40 characters either side of the error, with "…" at the cut points.
Remember that columns count from 1 and that tabs in the snippet are shown as single spaces. The caret marks the first character the parser could not accept, which is often just after the real mistake. Always look at the end of the line above as well.
The errors you will meet, and the fix for each
These are messages the validator really gives, in the order you are most likely to see them.
Trailing comma
Trailing comma — JSON doesn't allow a comma before "}".
A comma after the last item. The same message appears for "]". The caret sits on the comma itself. Delete it, or use Try auto-fix.
Missing comma between values
Expected "," or "}" but found a double quote ("). You may be missing a comma between two values.
Two items sit side by side with nothing between them. The caret is at the start of the second item, so add the comma at the end of the previous one.
{"name": "Karim" "age": 24}
Single quotes
Strings must use double quotes, not single quotes.
Or, for a key: "Property names must use double quotes, not single quotes." JSON never allows single quotes. Auto-fix converts them.
Property name without quotes
Property names must be wrapped in double quotes, e.g. "name": …
JavaScript allows {name: "x"}, JSON does not. Auto-fix adds the quotes.
Comments
Comments aren't allowed in JSON. Remove them (Auto-fix can do this).
Both // line and /* block */ comments are rejected. If you need notes, put them in a normal field such as "_note".
True, False, None, undefined, NaN
Unexpected word "True". Use lowercase "true".
Python and JavaScript values leak into JSON this way. Use true, false and null. For undefined the message says to use null, and for NaN and Infinity to use null or a string.
Unterminated string
Unterminated string — this string is missing its closing double quote.
This appears when a string runs to the very end of the text without closing, and the caret is at the start of that string. More often you will see its close relative, "Unescaped line break inside a string", which fires when a string is still open at the end of a line. It means a closing quote is missing, or that a real Enter key press sits inside quotes. Close the string, or write the break as \n.
Missing or mismatched brackets
Unexpected end of input — missing a closing "}" (2 brackets still open).
The text stopped before everything was closed, so the number tells you how many closers are missing. If you see "Mismatched brackets: found "}" but the open "[" needs "]" first", a bracket of the wrong kind is closing something.
Numbers
Numbers can't have leading zeros.
This appears for values like 01712345678. A phone number or an NID is not really a number, so put it in quotes: "01712345678". Other number messages cover a number starting with "." or "+", and "Invalid number format".
Extra text after the JSON
Unexpected "{" after the end of the JSON value. A JSON document can contain only one top-level value.
Two objects pasted one after another, or text after the final bracket. Wrap the objects in an array with commas, or remove the extra text.
Invalid escape
Invalid escape sequence "\d" inside a string.
Inside a string only \" \\ \/ \b \f \n \r \t and \uXXXX are allowed. This often happens with Windows paths and regular expressions: write each backslash twice, as in "C:\\Users".
Text that is not JSON at all
Unexpected "<" — expected a value (object, array, string, number, true, false or null).
A "<" at line 1, column 1 usually means you pasted an HTML error page instead of JSON. A plain word at the start gives "Unexpected word …". See what "unexpected token" means and how to fix it for this in detail.
Using Try auto-fix safely
When an error appears, a Try auto-fix button appears with it. It repairs these things:
- comments (
//and/* */) - single-quoted strings, converted to double quotes
- property names without quotes
- trailing commas
- True, False, None and undefined, replaced by true, false, null and null
- a byte-order mark at the start
It runs only when you click it, and it replaces the text in the input box. A list under the status shows each change, such as "Removed 1 comment" or "Removed 2 trailing commas". Read that list, because the new text is now what you have in the box. If you want your original, copy it somewhere first.
Try the Broken sample, which contains a comment, single quotes, a bare key, True and trailing commas. One click on Try auto-fix turns it into valid JSON.
Auto-fix does not guess. It cannot add a missing comma, close a bracket or repair a broken string. When it finds nothing safe to change it says so, and the position in the error message is your guide.
What "valid" does not prove
Green means the syntax is right. Several things still go unchecked:
- Required fields and types.
"age": "twenty"is valid JSON even if your app expects a number. - Duplicate keys. If a key appears twice in one object, the file is still accepted, and a parser keeps the last value.
- Very large numbers. Whole numbers above 9,007,199,254,740,991 are valid JSON, but JavaScript cannot hold them exactly. The page shows a yellow warning when it spots one. Keep long IDs as strings.
What it accepts and its limits
The validator accepts any valid JSON, including a top level that is an array, string, number, true, false or null, and ignores a leading BOM. The page sets no file-size limit of its own, so the practical limit is your device's memory. After a valid result, the Stats row shows input size, output size, keys, values and maximum depth.
Privacy
Validation runs in your browser. Your text is not uploaded, so you can safely check private API responses and configuration files.
Common situations
I need to check JSON from an API
Copy the response body from the browser's developer tools, paste it, and read the verdict. For readable output, press Text in the View switch and choose Beautify, or open the JSON Formatter.
The file validates but my program still rejects it
Check the shape of the data, not the syntax: field names, spelling and capitals, and whether numbers are written as strings. Sorting keys with the Sort keys A→Z option and comparing against a working file in the Text Diff Checker shows the difference quickly.
The error moves when I fix it
That is normal. The validator stops at the first problem, so fixing it lets it reach the next one.
Related tools
- JSON Formatter: beautify, minify, sort and explore valid JSON.
- Text Diff Checker: compare a broken file with a working one.
- Developer Tools: more tools for developers.
Quick checklist
- Read the line, the column and the sentence, then look one line above.
- Fix the first error only, then read the next.
- Put phone numbers, NIDs and long IDs in quotes.
- Use Try auto-fix for comments, quotes and trailing commas, and read its change list.
- Remember: valid syntax is not the same as correct data.



