Structured output
Making an AI reply in a fixed machine-readable format, such as JSON with named fields, so code can check and use the answer instead of parsing prose.
Updated October 2026 · with examples from our own builds
What does structured output mean in practice?
Instead of asking a model for a paragraph, you ask it to fill a schema: name, phone, issue, severity. Providers increasingly support strict structured output, where the reply must match the schema, and code can then validate each field and reject what doesn't fit.
This is what turns an AI demo into a dependable feature. A reply in a known shape can be checked, stored, retried and tested; a paragraph can only be read.
It shrinks the room for trouble as well. A model that can only fill named fields can't slip in instructions, links or extra claims, and a field it is unsure of can be left empty rather than guessed.
Structured output at a glance
- Format
- JSON matching a defined schema
- Enables
- Validation, retries and automated tests
- Good rule
- Allow empty fields rather than guesses
Where has structured output come up in our builds?
The card reader fills a strict JSON schema and is told to return null rather than guess; a card needs a name or company and one valid phone or email, or it waits for a person.
The same Zod schema that defines a reel validates what the AI returns when it turns a one-line idea into one, so a generated reel opens in the editor and renders without hand-fixing.
The model turns a request into a typed FormPlan; output that doesn't parse gets one stricter retry, and unknown field kinds are normalised against the field registry.
Common questions about structured output
What happens when the AI's reply doesn't match the format?
The code should catch it, retry once with stricter instructions and fall back to a safe outcome if it still fails, rather than passing a broken reply on.
Should the AI fill every field even when it isn't sure?
No. Let it return empty for anything it can't read or doesn't know, and let code or a person decide. A wrong value that looks right is worse than a blank.
Related terms
Sources
Planning a product and not sure where structured output fits? Ask us, or browse all 116 terms in the glossary.