Building with AI

JSON Schema

Quick explainer2 min readBeginner

JSON Schema is a standard way to describe what a piece of JSON data must look like, which fields it has, their types and their rules, so it can be checked automatically.

In plain words

JSON is a common text format for data. A JSON Schema is itself written in JSON and lists the rules: this field is required, that one must be a number, this one can only be one of three words. A validator checks real data against those rules. In AI apps, schemas tell a model exactly what shape its answer must have; features such as OpenAI's Structured Outputs hold a model's finished replies to a supplied schema.

A quick example

Imagine an app that asks a model to pull a person's name and age out of an email. The schema says name must be text, age must be a number, and both are required. The model's answer is checked against it, so the app never receives a missing field.

Where you'll meet it

  • Structured outputs and function calling with LLMs.
  • Validating data sent between programs and APIs.

Related

Sources

  1. DocsWhat is JSON Schema?, JSON Schema · read 29 Sept 2026
  2. DocsStructured model outputs, OpenAI API documentation · read 29 Sept 2026

Checked by WhatIsAI against the sources above · 11 Nov 2026. Spotted an error? Report it.