JSON Schema Validation vs JSON Syntax Validation
There are two levels of JSON validation:
- Syntax validation — Is this text valid RFC 8259 JSON? (Does it parse?)
- Schema validation — Does this JSON object match an expected structure? (Do all required fields exist with the right types?)
JSON Schema validation is the more powerful of the two — it can enforce field types, required properties, string formats, numeric ranges, and array constraints.
What JSON Schema Draft-07 Can Validate
required— enforce mandatory fieldstype— string, number, integer, boolean, object, array, nullformat— email, date-time, uri, uuidminimum/maximum— numeric range constraintsminLength/maxLength— string length constraintspattern— regex pattern matchingenum— allowed value enumeration