Utilumo
LightDarkSystem

Updated June 29, 2026

JSON Schema keywords

JSON Schema validates data using keywords. These are the ones you reach for most, grouped by what they apply to. Combine them to describe required fields, value types, and constraints.

Types and general

KeywordApplies toWhat it does
typeAnyRestricts the value's type: object, array, string, number, integer, boolean, or null.
enumAnyLimits the value to a fixed list of allowed values.
constAnyRequires the value to equal one exact value.
defaultAnySuggests a default; annotation only, not enforced.

Objects

KeywordApplies toWhat it does
propertiesobjectDefines a schema for each named property.
requiredobjectLists properties that must be present.
additionalPropertiesobjectAllows or forbids properties not listed in properties.
minProperties / maxPropertiesobjectLimits the number of properties.

Arrays

KeywordApplies toWhat it does
itemsarraySchema that every array element must match.
minItems / maxItemsarrayLimits the array length.
uniqueItemsarrayRequires all elements to be unique when true.

Numbers and strings

KeywordApplies toWhat it does
minimum / maximumnumberInclusive lower and upper bounds.
multipleOfnumberRequires the value to be a multiple of a given number.
minLength / maxLengthstringLimits the string length.
patternstringRequires the string to match a regular expression.
formatstringHints at a format such as email, date-time, or uri.

Snippet: required fields with types

A common object schema with required, typed properties.

{
  "type": "object",
  "required": ["id", "name"],
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string", "minLength": 1 }
  },
  "additionalProperties": false
}

Snippet: email and enum

A string with an email format and a field limited to set values.

{
  "type": "object",
  "properties": {
    "email": { "type": "string", "format": "email" },
    "role": { "type": "string", "enum": ["admin", "editor", "viewer"] }
  }
}

Snippet: array of objects

An array whose items each follow a schema.

{
  "type": "array",
  "items": {
    "type": "object",
    "required": ["sku"],
    "properties": {
      "sku": { "type": "string" },
      "qty": { "type": "integer", "minimum": 1 }
    }
  }
}
Combining schemasallOf, anyOf, and oneOf combine subschemas, and not negates one. They let you express unions and conditional rules.

References

Questions

Does 'required' make a property exist?

required lists which properties must be present for the data to be valid; it does not create them. A document missing a required property fails validation.

What is the difference between anyOf and oneOf?

anyOf passes if the data matches at least one subschema; oneOf passes only if it matches exactly one. Use oneOf for mutually exclusive options.