JSON Schema 2020-12 Keyword Reference
Core validation and composition keywords in JSON Schema 2020-12, with compact examples and traps.
Core validation and composition keywords in JSON Schema 2020-12, with compact examples and traps.
Core validation and composition keywords in JSON Schema 2020-12, with compact examples and traps. Each row includes a practical application and a failure to check before using it.
| Keyword | Example | Purpose | Pitfall |
|---|---|---|---|
| type | {"type":"string"} | Constrain the JSON value type. | A numeric-looking string is still a string. |
| properties | {"properties":{"name":{"type":"string"}}} | Validate named object properties. | Listed properties are optional unless required says otherwise. |
| required | {"required":["name"]} | Require object property presence. | Presence does not exclude an empty string or null by itself. |
| additionalProperties | {"additionalProperties":false} | Restrict properties not covered by properties or patternProperties. | Composition can require unevaluatedProperties instead. |
| unevaluatedProperties | {"unevaluatedProperties":false} | Restrict properties left unevaluated across applicable subschemas. | Use a validator with the correct draft support. |
| items | {"items":{"type":"integer"}} | Validate array items with one schema. | It does not require a nonempty array. |
| prefixItems | {"prefixItems":[{"type":"string"},{"type":"integer"}]} | Validate positional array elements. | Length constraints are separate. |
| minItems | {"minItems":1} | Require a minimum array length. | It does not constrain each item’s type. |
| enum | {"enum":["json","yaml","toon"]} | Accept one of an explicit set of values. | Values are case sensitive. |
| const | {"const":"ready"} | Accept one exact JSON value. | It can constrain more than strings. |
| minimum | {"minimum":0} | Set an inclusive numeric lower bound. | Strings are not numeric values. |
| pattern | {"pattern":"^[A-Z]{2}$"} | Validate a string with a regular expression. | Patterns are not anchored automatically. |
| allOf | {"allOf":[{"type":"integer"},{"minimum":0}]} | Require every subschema to pass. | It is logical intersection, not object inheritance. |
| anyOf | {"anyOf":[{"type":"string"},{"type":"number"}]} | Require at least one passing subschema. | Multiple matches are allowed. |
| oneOf | {"oneOf":[{"const":"a"},{"const":"b"}]} | Require exactly one passing subschema. | Overlapping alternatives cause rejection. |
| format | {"format":"date-time"} | Annotate a string with a named semantic format. | Assertion behavior depends on the dialect and validator. |
The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.
| Section | Field | Type | Example |
|---|---|---|---|
| data | keyword | string | type |
| data | example | string | {"type":"string"} |
| data | purpose | string | Constrain the JSON value type. |
| data | pitfall | string | A numeric-looking string is still a string. |
The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.
curl "https://yjtoon.com/api/dataset/json-schema-keywords?format=toon"
const res = await fetch( "https://yjtoon.com/static-data/dataset/json-schema-keywords.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →
Original editorial reference notes by YJTOON, informed by the linked primary documentation. External specifications retain their own licenses.
Editorial review: . Source documents keep their own licenses.