JSON Forge
100% Client-Side: your data is never sent to a server

JSON Schema Cheat Sheet

The keywords you use most often when writing a JSON Schema, grouped by what they validate.

Any value

KeywordMeaningExample
typeAllowed type(s): string, number, integer, boolean, object, array, null{"type": "string"}
enumValue must be one of a fixed list{"enum": ["admin", "viewer"]}
constValue must equal exactly this{"const": "v1"}

Objects

KeywordMeaningExample
propertiesSchema for each known key{"properties": {"id": {"type": "integer"}}}
requiredKeys that must be present{"required": ["id", "email"]}
additionalPropertiesfalse rejects keys not listed{"additionalProperties": false}
minProperties / maxPropertiesLimit the number of keys{"minProperties": 1}

Arrays

KeywordMeaningExample
itemsSchema for every element{"items": {"type": "string"}}
minItems / maxItemsLimit the length{"minItems": 1}
uniqueItemsNo duplicates{"uniqueItems": true}
prefixItems (2020-12)A different schema per position (tuples){"prefixItems": [{"type": "number"}, {"type": "string"}]}

Strings and numbers

KeywordMeaningExample
minLength / maxLengthString length limits{"minLength": 1}
patternRegular expression the string must match{"pattern": "^[a-z]+$"}
formatemail, date-time, uri, uuid and others{"format": "email"}
minimum / maximumInclusive numeric limits{"minimum": 0}
exclusiveMinimum / exclusiveMaximumExclusive limits (numbers since draft-06; booleans in draft-04){"exclusiveMinimum": 0}
multipleOfMust be a multiple of{"multipleOf": 0.01}

Combining and reusing

KeywordMeaningExample
allOfMust match every schema{"allOf": [{...}, {...}]}
anyOfMust match at least one{"anyOf": [{"type": "string"}, {"type": "null"}]}
oneOfMust match exactly one{"oneOf": [{...}, {...}]}
notMust not match{"not": {"type": "null"}}
if / then / else (draft-07+)Conditional rules{"if": {...}, "then": {...}}
$defs and $refDefine a part once and reuse it (older drafts: definitions){"$ref": "#/$defs/address"}

Good to know

Validate against a schema · All cheat sheets · JSON examples