← AI glossary

AI glossary · Basic · Language models · Agents

Structured output

Structured output is a feature that makes an AI model answer with data that fits a fixed format (a schema), such as JSON, instead of free-form text. It lets programs read and use the model's answer directly.

About this term
Level
Basic · Technical terms you often meet in AI news
Added
2026-10-08
In plain words It is like handing a customer a form with separate boxes for name, phone number and address instead of saying "write whatever you like." Because the boxes are fixed, the person receiving it can organize the information much more easily.

How it works

The developer first defines a schema listing the fields the answer must contain and the type of each field (text, number, list and so on). When this schema is passed to the model along with the request, the model produces data that fits it. Some services guarantee the format by blocking the model from choosing any token that does not fit the schema as it generates text one piece at a time. Without such a mechanism, the result is checked and the request is sent again if the format is wrong.

Structured output flowSchema → LLM; User request → LLM; LLM → Format check(JSON); Format check → Program(Pass); Format check → LLM(Request again)SchemaDefine fields andtypesLLMGenerate to fit theformatFormat checkCompare against theschemaProgramUses JSON dataUser requestJSONPassRequest again
Structured output flow Read from left to right. The dotted line at the bottom is the loop that sends the request again if the format check fails.

Why it matters

People read and understand sentences, but programs cannot reliably extract data unless it is in a fixed format. If you only ask in the prompt to "answer in JSON," a bracket is sometimes missing or an unnecessary explanation is added, which can make the program fail. Structured output reduces these mistakes so AI can be connected reliably to real services and business systems. Function Calling and tool use by AI agents rely on the same principle.

Things to know

A correct format does not mean the content is correct. The model may invent plausible values to fill the fields, so the hallucination problem remains. Overly complex or strict schemas can actually lower answer quality. So it is a good idea to include fields that can be left empty when there is no answer, and to verify important values separately.

Example

This glossary page is built in a similar way. The model is given a schema with fixed fields such as 'short definition,' 'analogy,' 'section list' and 'related terms,' and it answers with JSON that fills those fields. The program can take this JSON and display it directly as a web page.

Related terms