All terms · Workflows & Patterns

Structured Output

A mode where the model is constrained to return responses in a specific format — typically JSON — that matches a defined schema.

Structured Output (sometimes called JSON mode or constrained generation) forces the model to produce responses that conform to a predefined schema. Instead of returning free-form text, the model returns a JSON object (or other structured format) with exactly the fields specified.

Why it matters for production applications: - Downstream code can parse the response reliably without regex or post-processing hacks - Schema validation can be applied before the response is used - Reduces errors from models inventing field names or omitting required data

Implementation approaches: - JSON mode: the model is instructed or constrained to output valid JSON - Schema-constrained generation: the model's output is constrained token-by-token to fit a JSON Schema - Tool/function calling: the model calls a function with typed arguments, which is returned as structured data

Most production AI applications use structured output for any data extraction, classification, or decision-making task where the result needs to be consumed programmatically.

Example

A contract analysis tool asks Claude to extract key dates, parties, and obligations from a PDF. Structured Output ensures the result is always a JSON object with consistent field names, ready to insert into a database.