JSON Validator
Paste JSON and it is checked as you type. Errors are pinned to the exact line and column with a plain-English reason and a fix tip, and common mistakes such as trailing commas, single quotes and comments can be repaired in one click.
How to use the JSON Validator
- Paste or type your JSON in the editor, or upload a .json file. It is validated automatically.
- Read the result. A green bar means valid JSON. A red bar shows the line, column and reason, and the error line is highlighted.
- Follow the fix tip or press Auto-fix to repair common mistakes like trailing commas, single quotes and comments.
- Press Go to error to jump the cursor straight to the problem.
- Format or minify valid JSON, then copy or download it.
JSON error messages explained
| Message | Invalid | Valid |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Strings must use double quotes | {'id': 'a1'} | {"id": "a1"} |
| Property names must be wrapped in double quotes | {id: 7} | {"id": 7} |
| Missing "," between properties | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Comments are not allowed | {"a": 1} // note | {"a": 1} |
| Not valid JSON: use null / true | None, True, undefined, NaN | null, true |
| Invalid escape sequence | "C:\Temp" | "C:\\Temp" |
| Leading zeros are not allowed | {"zip": 01234} | {"zip": "01234"} |
| Unexpected end of input | {"a": [1, 2} | {"a": [1, 2]} |
The JSON syntax rules in one minute
JSON (RFC 8259 / ECMA-404) has six value types: object {"key": value}, array [value, value], string in double quotes, number (decimal, optional minus, fraction and exponent, no leading zeros), and the literals true, false and null. Keys are always double-quoted strings. Items are separated by commas with no comma after the last one. Whitespace between tokens is ignored, but there are no comments.
Inside a string, a double quote, a backslash and control characters such as line breaks must be escaped: \", \\, \n, \t, or \u0041 for any character by its code.
Tips for finding the real mistake
- A parser stops at the first problem, so the reported position is where it noticed the error. A missing comma or quote is often at the end of the previous line.
- "Unexpected end of input" means a bracket or string was never closed. The message names the bracket and the line where it was opened.
- Copying from documents and chat apps can turn straight quotes into curly “smart” quotes, which JSON does not accept.
- Large integers such as IDs over 9,007,199,254,740,991 are valid JSON, but JavaScript reads them with rounding. Store them as strings if exact values matter.
Frequently asked questions
How do I know if my JSON is valid?
Paste it into the validator. Valid JSON shows a green "Valid JSON" bar with its size, number of keys and nesting depth. Invalid JSON shows a red bar with the line and column of the first error and the reason.
What are the most common JSON errors?
A trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments, a missing comma between items, and values from other languages such as True, None, undefined or NaN.
What does Auto-fix change?
It removes comments and trailing commas, converts single-quoted and curly-quoted strings to double quotes, quotes bare property names, adds missing commas between items on separate lines, turns True/False/None into true/false/null, replaces undefined and NaN with null and closes unclosed brackets. Review the result: it repairs syntax, it cannot guess missing data.
Are duplicate keys invalid JSON?
The JSON standard (RFC 8259) says names within an object SHOULD be unique but does not forbid duplicates, so they pass validation. Most parsers silently keep only the last value, which is why the validator shows a warning.
Why is the column number different from my editor?
The column counts characters from the start of the line, starting at 1, with a tab counted as one character. Editors that expand tabs to several spaces may show a larger column.
Is my JSON uploaded anywhere?
No. Validation, auto-fix and formatting all run in JavaScript in your browser. Your data never leaves your device.
Does it support JSON5 or JSON with comments?
The validator is strict and reports comments, single quotes and trailing commas as errors because standard JSON parsers reject them. Use Auto-fix to convert JSON5-style input into standard JSON.