JSON Schema Cheat Sheet
A searchable reference of JSON Schema keywords and what each validation rule does.
| Keyword | What it does |
|---|---|
type: string | Value must be a JSON string. Example: {"type": "string"} accepts "hello". |
type: number | Value must be a number, integer or decimal, such as 3.14 or 42. |
type: integer | Value must be a whole number with no fractional part, such as 42. 5.0 is accepted but 5.5 is not. |
type: boolean | Value must be true or false. The strings "true" and "false" do not count. |
type: object | Value must be a JSON object of key-value pairs, such as {"id": 1}. |
type: array | Value must be a JSON array, such as [1, 2, 3]. |
type: null | Value must be the JSON null. This is different from a key being absent. |
type: [string, null] | An array of type names allows any listed type, so this matches a string or null (a nullable string). |
enum | Value must be exactly one item from a fixed list. Example: {"enum": ["red", "green", "blue"]}. |
const | Value must equal one single fixed value. Example: {"const": "v1"} accepts only "v1". |
minLength | Minimum number of characters a string may have. {"minLength": 3} rejects "hi". |
maxLength | Maximum number of characters a string may have. {"maxLength": 5} rejects "abcdef". |
pattern | String must match a regular expression. Example: {"pattern": "^[a-z]+$"} allows only lowercase letters. |
format: email | Annotates that the string should be an email address like "a@b.com". Format checks are optional in draft 2020-12. |
format: date-time | Annotates an RFC 3339 timestamp such as "2026-07-04T10:00:00Z". |
format: uri | Annotates a full URI such as "https://example.com/path". |
format: uuid | Annotates a UUID string. Formats are assertions only when the validator opts in, otherwise just hints. |
minimum | Smallest allowed value, inclusive. {"minimum": 0} allows 0 and above. |
maximum | Largest allowed value, inclusive. {"maximum": 100} allows up to and including 100. |
exclusiveMinimum | Value must be strictly greater than this number. {"exclusiveMinimum": 0} rejects 0. |
exclusiveMaximum | Value must be strictly less than this number. {"exclusiveMaximum": 1} rejects 1. |
multipleOf | Value must be a multiple of this number. {"multipleOf": 5} allows 0, 5, 10. |
properties | Declares a schema per named key. Example: {"properties": {"name": {"type": "string"}}}. |
required | Lists key names that must be present. Example: {"required": ["id", "name"]}. |
additionalProperties | Controls keys not named in properties. Set false to forbid extras, or a schema to constrain them. |
patternProperties | Applies a schema to keys matching a regex. Example: keys matching "^x-" must be strings. |
minProperties | Minimum number of keys the object must have. {"minProperties": 1} forbids an empty object. |
maxProperties | Maximum number of keys the object may have. |
propertyNames | Every key name itself must match this schema, for example a pattern all keys must follow. |
dependentRequired | If one key is present, other keys become required. Example: if "credit_card" is set, also require "billing_address". |
items | Schema every array element must match. {"items": {"type": "number"}} means a list of numbers. |
prefixItems | Schemas for the first N positions, one per slot, to validate a tuple like [string, number]. |
minItems | Minimum number of elements the array must have. {"minItems": 1} forbids an empty array. |
maxItems | Maximum number of elements the array may have. |
uniqueItems | When true, every element must be distinct, so [1, 1] fails. |
contains | At least one element must match the given schema, for example at least one string in the array. |
minContains | Sets how many elements must match contains, for example at least 2. Used together with contains. |
allOf | Value must satisfy every subschema in the list at once (logical AND). |
anyOf | Value must satisfy at least one subschema (logical OR); more than one may match. |
oneOf | Value must satisfy exactly one subschema; matching zero or two or more fails. |
not | Value must NOT satisfy the given subschema. {"not": {"type": "string"}} rejects strings. |
if / then / else | Conditional schema: if the "if" subschema matches, apply "then", otherwise apply "else". |
$ref | Reuse another schema by reference. {"$ref": "#/$defs/Address"} points at a shared definition. |
$defs | Holds reusable subschemas that $ref can point to, such as a shared "Address" definition. |
title | A short human-readable name for the schema. Annotation only; it does not affect validation. |
description | A longer human-readable explanation of the schema. Annotation only; it does not affect validation. |
default | Suggests a default value for tools and docs. It does not fill in missing data during validation. |
examples | An array of sample valid values for documentation. Annotation only; it is not enforced. |
No keywords match your search.
Runs entirely in your browser. Nothing you type is sent anywhere; open DevTools and watch the Network tab to verify zero requests.
What this tool does
This is a searchable quick reference for the keywords in JSON Schema draft 2020-12, the version most modern validators use. Each row pairs a keyword with a plain-English note on what it constrains, and many include a tiny example. The keywords are grouped by what they act on: value types, strings, numbers, objects, arrays, and the composition and reference keywords that combine schemas. The whole list is built into the page, so it works offline and sends nothing anywhere.
How to use it
Start typing in the Filter box. Entering required jumps
to the object keyword that lists mandatory keys; entering oneOf surfaces
the composition keywords; entering format shows the string format
annotations. The category buttons (Types, String, Number, Object,
Array, Composition) narrow the table to one group and combine with the text filter, so
you can pick Object and type additional to land on
additionalProperties. Clear the box to see the full sheet again.
Common use cases
- Recalling the exact keyword for a constraint, such as
multipleOffor step values oruniqueItemsfor a set. - Deciding between
anyOf,oneOf, andallOfwhen a value can take several shapes. - Writing a strict object schema with
requiredandadditionalPropertiesset to false. - Structuring a reusable schema with
$defsand pointing at it using$ref. - Reviewing the core JSON Schema vocabulary before writing an API contract or config validator.
Notes on draft 2020-12
- Formats are annotations by default. Keywords like
format: emaildo not reject bad values unless the validator is configured to treat formats as assertions. Usepatternwhen you need a guaranteed check. - Array validation changed. Draft 2020-12 uses
prefixItemsfor tuple positions and reservesitemsfor the schema applied to the remaining elements. Older drafts used an array form ofitemsinstead. - required does not create keys. Listing a key in
requiredonly asserts it is present; it does not add a default or stop a null value on its own. Pair it withtypeto constrain the value too. - oneOf is exclusive. If two branches can both accept a value,
oneOffails even thoughanyOfwould pass. Reach foroneOfonly when the options are truly mutually exclusive.
Frequently asked questions
- What is JSON Schema?
- JSON Schema is a vocabulary for describing the shape of JSON data: which keys exist, what types they hold, and which values are allowed. You write the schema as its own JSON document and feed it, along with your data, to a validator that reports whether the data conforms. It is widely used to validate API request bodies, config files, and form input. This sheet covers the draft 2020-12 keywords.
- What is the difference between anyOf and oneOf?
- Both combine subschemas, but they differ in how many must match. anyOf passes when the value matches at least one subschema, and it is fine if several match at the same time. oneOf is stricter: the value must match exactly one subschema, so if two of them accept the value, validation fails. Use anyOf for a plain OR, and oneOf when the options are meant to be mutually exclusive.
- How do I make a field required in JSON Schema?
- Add a required keyword at the object level listing the key names that must be present, for example {"required": ["id", "name"]}. Note that required only checks that a key exists; it does not stop the value from being null unless you also constrain its type. A key defined under properties stays optional until you name it in required.
- What does additionalProperties do?
- additionalProperties controls keys that are not listed in properties and not matched by patternProperties. Set it to false to forbid any extra keys, which is useful for catching typos and locking down a strict object. Set it to a schema to allow extra keys but require their values to match that schema. Left unset, extra keys are allowed with no constraint.
- What is $ref for?
- $ref lets you reuse a schema by pointing at it instead of repeating it. The value is a URI reference; a common form is {"$ref": "#/$defs/Address"}, which points at a subschema stored under $defs in the same document. This keeps large schemas from repeating themselves and lets you define a shape once and reference it from many places, including recursively.
- Does this tool send my schema anywhere?
- No. The entire keyword list is baked into the page at build time and all searching and filtering happen locally in your browser with JavaScript. Nothing you type is sent to any server. Open your browser DevTools and watch the Network tab while you use the tool to confirm there are zero requests.
Cite this tool
For academic, journalistic, or technical references. Pick a format:
Citations use 2026 as the publication year. Access date is left as a fillable placeholder where the citation style expects one.