Developer guide
How to validate JSON and fix syntax errors
JSON validation begins with syntax: confirm that strings, numbers, arrays, objects, separators, and escape sequences follow the JSON grammar.
Open the JSON ValidatorWhat a JSON validator checks
A syntax validator checks whether the entire document can be parsed as JSON. It catches missing quotes, mismatched brackets, misplaced commas, invalid escapes, and malformed numbers.
It does not know whether an email field contains an email address or whether required properties are present. Those are schema or application checks.
How to validate JSON
- Paste the document or open a JSON file.
- Select Validate JSON.
- Read the first error and use Go to error when available.
- Inspect the character at that position and the token immediately before it.
- Fix one error, validate again, and continue until the document passes.
Parser errors often point to where the parser became certain something was wrong, not to the exact character that caused it.
Frequent JSON syntax errors
| Invalid pattern | Correction |
|---|---|
{name: "A"} | Quote the property name |
{"name": 'A'} | Use double quotes |
{"a": 1,} | Remove the trailing comma |
{"a": undefined} | Use a valid JSON value |
Syntax validation versus JSON Schema
Syntax validation answers, "Can this text be parsed as JSON?" JSON Schema can answer questions about property types, allowed values, required members, array sizes, and nested structure.
A document can be perfectly valid JSON and still be wrong for an API. Validate syntax first, then apply the contract required by the receiving system.
Details that affect error reports
- Line and column numbers begin at 1 in the ToolPixels report.
- Columns use UTF-16 text positions, which matters around some Unicode characters.
- Duplicate keys are not reported as a syntax error.
- Large numbers can be valid JSON but exceed another program's numeric range.
- Only the first syntax error is reliable until it is fixed.
Try it with ToolPixels
Check JSON syntax locally and jump to the first parser error without uploading the data.