All Cheat SheetsJSON
JSON Schema Cheat Sheet
Complete reference for Draft-07 and 2020-12 JSON Schema validation keywords
Basic Type Definitions
Specify acceptable data types for properties
StringMatches any UTF-8 string text
{ "type": "string" }Number / IntegerFloating point or whole integer
{ "type": "number" }
{ "type": "integer" }Booleantrue or false
{ "type": "boolean" }NullMatches null value explicitly
{ "type": "null" }Multiple Allowed TypesAllows either string or null
{ "type": ["string", "null"] }String Constraints & Formats
Validate string length, regex patterns, and standard formats
Length limits
{ "type": "string", "minLength": 3, "maxLength": 50 }Regex pattern match
{ "type": "string", "pattern": "^[a-z0-9_-]+$" }Email format
{ "type": "string", "format": "email" }URI / URL format
{ "type": "string", "format": "uri" }Date-Time ISO 8601
{ "type": "string", "format": "date-time" }UUID format
{ "type": "string", "format": "uuid" }Numeric Constraints
Boundary checking and divisibility
Range boundaries
{ "type": "number", "minimum": 0, "maximum": 100 }Exclusive bounds
{ "type": "number", "exclusiveMinimum": 0 }Multiple of stepMatches 5, 10, 15, 20...
{ "type": "number", "multipleOf": 5 }Object & Property Rules
Enforce required keys and forbid undeclared properties
Required fields
{ "type": "object", "required": ["id", "email"] }Strict (No extra keys)
{ "type": "object", "additionalProperties": false }Property count bounds
{ "type": "object", "minProperties": 1, "maxProperties": 10 }Array Constraints
Enforce list items and uniqueness
Uniform items
{ "type": "array", "items": { "type": "string" } }Unique elements (Set)
{ "type": "array", "uniqueItems": true }Array size range
{ "type": "array", "minItems": 1, "maxItems": 100 }Composition & Logic
Combine multiple schema constraints
allOf (AND)
{ "allOf": [{ "$ref": "#/defs/User" }, { "required": ["role"] }] }anyOf (OR)
{ "anyOf": [{ "type": "string" }, { "type": "number" }] }oneOf (XOR)
{ "oneOf": [{ "required": ["email"] }, { "required": ["phone"] }] }not (Invert)
{ "not": { "type": "string" } }