Skip to content
Last Dictionary

JSON Schema

proper noun

In plain wordsA standard way of writing down exactly what a piece of JSON data must look like — which fields, of which types — so that software and AI models can check it or follow it.

  1. A specification language, itself expressed in JSON, for stating the constraints a conforming JSON document must satisfy so that tools can check documents against them: allowed types (object, array, string, number, integer, Boolean, null), required and optional properties, enumerated values, numeric ranges, string patterns and formats, array lengths, and composition with keywords such as allOf, anyOf, oneOf and $ref for reusable or recursive definitions. Validators exist in every major programming language, and the OpenAPI specification uses JSON Schema to describe web-API payloads. In AI engineering it is the common language for telling models what to produce: function and tool definitionsfunction calling, n.: A feature of AI model services that lets the model reply with a neatly formatted request to run one of a program's functions, rather than with ordinary text; the program, not the model, then runs it. in model APIs and in the Model Context ProtocolModel Context Protocol, prop. n.: An open standard that lets AI assistants plug into outside apps and data — files, calendars, databases, business software — through one common connector instead of a custom link for every pairing; often likened to a USB-C port for AI. declare their parameters in JSON Schema, and structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork. features compile a schema into a grammar for constrained decodingconstrained decoding, n.: Forcing an AI model's output to follow a required format — such as valid code or a fill-in form — by blocking, at every step, any word that would break the rules.. Providers usually accept only a subset of keywords in strict modes, for example requiring every property to be listed as required.

    Paste the JSON Schema for the order object into the tool definition so the model fills every field.

Origin

Proposed by Kris Zyp, who submitted the first JSON Schema proposal to the json.com website in October 2007. His first IETF Internet-Draft followed in December 2009, and the specification then evolved through a long series of drafts, of which draft-04 (2013) and 2020-12 are the most widely deployed. Its central role in AI began when OpenAI's function-calling API (June 2023) adopted it for parameter definitions.

Usage note

JSON Schema checks shape, not meaning: it can require a string in date format but cannot tell whether the date is the right one. Differences between drafts matter, because keywords and their behavior changed from version to version.

Related

See also
  • structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork.
  • JSON modeJSON mode, n.: A setting on some AI services that makes the model reply only in JSON, a standard text format for data, so that programs can read the reply reliably.
  • function callingfunction calling, n.: A feature of AI model services that lets the model reply with a neatly formatted request to run one of a program's functions, rather than with ordinary text; the program, not the model, then runs it.
  • tooltool, n.: Any outside capability an AI model is allowed to use — a web search, a calculator, a code runner, a database or an app — described to the model so it can ask for it by name.
  • Model Context ProtocolModel Context Protocol, prop. n.: An open standard that lets AI assistants plug into outside apps and data — files, calendars, databases, business software — through one common connector instead of a custom link for every pairing; often likened to a USB-C port for AI.
  • constrained decodingconstrained decoding, n.: Forcing an AI model's output to follow a required format — such as valid code or a fill-in form — by blocking, at every step, any word that would break the rules.

Sources

  1. JSON Schema project. Specification links (draft history from draft-zyp-json-schema-00, 2009, to 2020-12). json-schema.org. json-schema.org/specification-links

Mentioned in

constrained decodingconstrained decoding, n.: Forcing an AI model's output to follow a required format — such as valid code or a fill-in form — by blocking, at every step, any word that would break the rules., function callingfunction calling, n.: A feature of AI model services that lets the model reply with a neatly formatted request to run one of a program's functions, rather than with ordinary text; the program, not the model, then runs it., structured outputsstructured outputs, n.: Getting an AI model to answer in an exact, machine-readable format — like a form with fixed fields — so other software can use the answer without guesswork., tooltool, n.: Any outside capability an AI model is allowed to use — a web search, a calculator, a code runner, a database or an app — described to the model so it can ask for it by name., JSON modeJSON mode, n.: A setting on some AI services that makes the model reply only in JSON, a standard text format for data, so that programs can read the reply reliably.