JSON Schema
A vocabulary for describing the shape of JSON data, and the lingua franca of model tool interfaces.
JSON Schema is a specification for describing the structure of JSON documents: what properties an object has, what types they hold, which are required, what values are permitted. It is used for validation, for documentation, and — most relevantly here — as the interchange format in which tools and structured outputs are described to a Large Language Model.
Because it is the format the model actually sees, the compiled schema is the artifact worth inspecting. Source-level schema code and the JSON Schema it produces are not the same thing, and several important properties are only visible in the compiled form: how many optional properties a union really contributes, whether a shared definition was inlined twice rather than referenced, and which constraints survived compilation at all. See Constrained Decoding.
JSON Schema is also expressive enough to state things that no grammar can enforce. Length bounds, numeric ranges, and pattern matching are commonly stripped during compilation and demoted to prose in the field's description. Anything expressed as a custom predicate in a source-level schema library typically vanishes from the compiled output entirely — validated at runtime, invisible to the model.
Descriptions are a first-class part of the schema, not decoration. They are the only place a field can explain itself to the model.
See also4
Hand-picked in the note itself — the neighbours worth reading next.
Schema Validation
Checking data against a declared shape at runtime, and using the result as the typed value.
Agents & Language Models11 connections
Structured Output
Constraining a model to emit data conforming to a declared schema rather than free text.
Agents & Language Models11 connections
Tool Use
Giving a model a set of callable functions so it can act on the world rather than only describe it.
Agents & Language Models24 connections
Structured Data
Machine-readable markup describing what a page is about, in a shared vocabulary.
Data & Content10 connections
Related3
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from6
Notes elsewhere in the wiki that reach for this one.
- Constrained DecodingAgents & Language Models
Restricting a model's next-token choices to those a formal grammar permits.
- Model RoutingAgents & Language Models
Choosing which model handles which step, trading capability against cost and latency.
- Schema ValidationAgents & Language Models
Checking data against a declared shape at runtime, and using the result as the typed value.
- Structured DataData & Content
Machine-readable markup describing what a page is about, in a shared vocabulary.
- Structured OutputAgents & Language Models
Constraining a model to emit data conforming to a declared schema rather than free text.
- Tool UseAgents & Language Models
Giving a model a set of callable functions so it can act on the world rather than only describe it.