Structured output
Structured output is any production prompt pattern that forces a language model to return data in a deterministic, machine-parseable form (JSON, XML, custom).
Structured output is the umbrella term for JSON mode, json_schema, XML tagging (Claude), tool-call arguments, and any other constraint that makes the model's output parseable by downstream code without retries. In 2026 the most reliable form is JSON Schema-constrained decoding (OpenAI's strict mode, Anthropic via tool use, Gemini's response_schema) — the model literally cannot emit invalid output. This is the production-grade replacement for 'return JSON' prompting plus regex fallbacks.
When to use structured output
- Any output that downstream code parses.
- Extraction, classification, form-filling, tool arguments.
Common mistakes
- Asking for JSON in the system prompt without a schema.
- Schemas with deeply nested unions — smaller models get confused.
FAQ
What is structured output?
Structured output is any production prompt pattern that forces a language model to return data in a deterministic, machine-parseable form (JSON, XML, custom).
When should I use structured output?
Any output that downstream code parses. Extraction, classification, form-filling, tool arguments.
What are the most common mistakes with structured output?
Asking for JSON in the system prompt without a schema. Schemas with deeply nested unions — smaller models get confused.
Related terms
- JSON mode (structured output) — JSON mode forces a language model to emit only syntactically valid JSON, usually conforming to a schema you supply.
- Function calling (tool use) — Function calling lets a language model emit a structured request to invoke a developer-defined tool, enabling reliable JSON output and agent workflows.
- System prompt — A system prompt is the high-priority instruction block that defines a model's role, constraints, and default behaviors for an entire conversation.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/structured-output.md.