FormattersLesson 4Free preview
JSON Validator
This lesson is part of Web Developer Tools · All levels
Summary
JSON Validator checks that JSON text complies with syntax rules, and then indicates the error location if any. The important rule among others is that the key must be double quoted, there must be no over-commas, and all the keys must be paired. Syntax validation is different from schema validation: JSON can be syntax validated but still not in accordance with data contracts. Therefore, validation should be done before data is sent or stored.
Key points
- Checking the JSON syntax and displaying the error position
- The key must be double quoted, not single quoted.
- Trailing commas and comments are not allowed in JSON
- Valid syntax not necessarily according to JSON Schema
- Always validate the data from outside before further processing.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.