JSON Schema

JSON Schema is a declarative language for describing and validating the structure of JSON data. A schema is itself a JSON document that states what a valid instance looks like: which properties an object may or must have, the types of values, numeric ranges, string patterns, array constraints, and how subschemas combine through keywords such as allOf, anyOf, and oneOf. Rather than writing imperative parsing and checking code, a developer declares the expected shape once and lets a validator confirm that arbitrary JSON conforms to it.

The specification is organized into two main documents. JSON Schema Core, as the official specification page states, “defines the basic foundation of JSON Schema,” including the structural concepts of schemas, keywords, references, and the meta-schemas that validate other schemas. JSON Schema Validation “defines the validation keywords of JSON Schema,” the assertions such as type, required, minimum, and pattern that constrain instance data. A companion Relative JSON Pointers document supports referencing within documents.

JSON Schema evolved through a series of named drafts rather than a single release. Early drafts date to the late 2000s, and the language matured through draft-04, draft-06, draft-07, and the 2019-09 and 2020-12 releases. The 2020-12 release is the current version and superseded 2019-09. The draft naming reflects the project’s standardization path through the Internet Engineering Task Force, even as the specification documents are published and maintained at json-schema.org by the JSON Schema community.

A defining feature is the meta-schema: because a JSON Schema is just JSON, it can itself be validated against a schema that describes valid schemas. JSON Schema also organizes its keywords into vocabularies, so that different applications can adopt the subset of behavior they need, from pure structural validation to hyperlinking and recommended output formats. This modularity lets the same core machinery serve documentation, form generation, and data validation alike.

JSON Schema became foundational to the modern web API ecosystem largely through its adoption by the OpenAPI Specification, which uses a JSON Schema dialect to describe the request and response payloads of HTTP endpoints. From a schema, tools can generate code, build interactive documentation, drive automated tests, and reject malformed input at the boundary of a service. By giving JSON, an otherwise schemaless format, a precise and machine-readable contract, JSON Schema let teams agree on data shapes across language and organizational boundaries.