Step-by-step
- Paste the JSON into the JSON Validator.
- Run the check and read the result. A valid document is confirmed, and an invalid one shows an error message.
- Use the position or line information in the message to find the problem in your text.
- Fix the first error, then validate again. Later errors are often hidden until the first is fixed.
- When the syntax is valid, check the structure against a JSON Schema if your application needs specific fields.
Syntax validity and schema validity
A syntax validator answers one question: can this text be parsed as JSON? A document can be syntactically valid and still wrong for your application, for example a number where you need a string, or a missing field. A JSON Schema validator checks the structure, field types and required properties.
Reading an error message
Parser messages usually name the unexpected character and its position. The real mistake is often just before that point, such as a missing comma at the end of the previous line or an unclosed quote earlier in the text. Look a few characters before the reported position as well as at it.
Common reasons JSON fails validation
These causes account for most failures.
- A trailing comma after the last item.
- Single quotes, or keys without quotes.
- Comments added to a configuration file.
- Smart quotes copied from a web page or document.
- A truncated response where the closing bracket is missing.
Finish the task with DevUtilityKits
Use the relevant online utility, check the result, and continue with your development workflow.
Open JSON Validator →Open JSON Formatter →Open JSON Schema Validator →