Structured Output
Also called Structured outputs, JSON mode, Constrained decoding
Getting an AI model to answer in a fixed, machine-readable format, usually JSON that matches a schema, instead of free text.
What is structured output?
Structured output is when an AI model returns data in a predictable format that software can read directly, rather than a paragraph a person has to interpret. You describe the shape you want, typically as a JSON schema (field names, types, which fields are required), and the model's answer follows it.
For example, from a customer email you might ask for the customer's name, their order number, and the type of issue as one of "refund", "delivery" or "other".
How does it work?
There are two levels:
- Asking in the prompt: describing the format in words. This usually works but can fail: a missing field, an extra sentence before the JSON, or a value outside your list.
- Enforced structure: many model APIs can restrict the model's output as it is generated, so it always matches your schema. Providers call this structured outputs or constrained decoding.
Function calling uses the same idea: the model fills in a tool's arguments in a defined format.
What is it commonly confused with?
- Correct output. A schema guarantees the shape, not the truth. A field can be perfectly formatted and still wrong, so check values that matter.
- JSON mode. In some APIs, "JSON mode" only promises valid JSON, not JSON that matches your particular schema.
Why does it matter?
Structured output is what lets AI fit into real software: filling databases, triggering workflows, and passing results between the steps of a prompt chain. Without it, developers write fragile code to pull answers out of free text.

