PromptForge
AI Glossary

Prompting techniques

JSON Schema

Also known as: schema, json schema validation

Definition

JSON Schema is a standard vocabulary for describing the shape of JSON data — its keys, types and required fields. AI providers use it to constrain model output to a guaranteed structure.

A schema declares what valid data looks like: which properties exist, their types, which are required, and what values are permitted. Providers that support structured output take a schema and guarantee the model's response conforms to it.

This turns a probabilistic system into a dependable component. Without a schema you hope for valid JSON and write defensive parsing; with one you can rely on the shape and validate only semantics.

Schemas double as documentation for the model. Descriptive property names and per-field descriptions measurably improve extraction accuracy, because the schema is telling the model what each field means.

Example

{"type":"object","properties":{"sentiment":{"type":"string","enum":["positive","neutral","negative"]},"score":{"type":"number"}},"required":["sentiment"]}

Related terms

Put this into practice

Understanding the term is step one. Our free courses and tools let you actually use it.