Ajv supports JSON Type Definition
JSON Type Definition (JTD) is a new specification for defining JSON structures that is very simple to use, comparing with JSON Schema, less error prone, and it is published as RFC8927 (opens new window).
See Choosing schema language for a detailed comparison between JSON Schema and JSON Type definition and informal specification.
In addition to validation, Ajv also supports:
- generation of serializers and parsers from JTD schemas/ This is more efficient than native JSON serialization/parsing - you can combine JSON string parsing and validation in one function call.
- utility type JTDSchemaType to convert your data type to the type of JTD schema and JTDDataType to convert the type of schema to the type of data.