In plain words
Ask a chatbot to pull the name, date and amount out of an invoice and it might answer in a friendly paragraph. A person can read that. A program cannot: it needs the same three labelled boxes, in the same order, every single time.
Structured output solves this. The developer describes the exact shape of the answer, such as "a name as text, a date, an amount as a number". The AI is then made to reply in that shape, usually in a format called JSON that software reads easily.
It is what lets apps use AI as a dependable part: sorting emails into folders, turning a photo of a bill into a spreadsheet row, or passing clean instructions to another tool.
Everyday example
A form instead of a letter
A bank could ask customers to write a letter explaining who they are. Every letter would be different, and a clerk would have to dig out the details. Instead it hands over a form: name here, date of birth here, PAN number in these ten boxes. Structured output gives the AI the form, so every answer arrives with the same boxes filled.
Where the example breaks: A form cannot stop someone writing a wrong date in the right box. Structured output guarantees the shape of the answer, not that the values inside are true.
How it actually works
The format is usually JSON, and the shape is described with JSON Schema, a standard way to say which fields exist and what type each one is.
Describe the shape
The developer sends a schema with the prompt, for example:
nameis text,amountis a number,paidis true or false, and all three are required.Constrain each step
A model writes one token at a time. With strict structured output, the system converts the schema into a grammar and, at every step, blocks any token that would break it. OpenAI calls this constrained decoding.
Older way: ask nicely
Before this, developers asked in the prompt for JSON, or used "JSON mode", which made valid JSON likely but did not enforce particular fields. Missing or misspelled fields still slipped through.
- JSON mode
- OpenAI, November 2023: valid JSON, but no guarantee of a particular schema
- Schema guaranteed
- OpenAI Structured Outputs, August 2024. On its complex schema test, the new model scored 100%, an older model "less than 40%"
- Also offered by
- Google's Gemini API (JSON Schema responses) and Anthropic's Claude API, which added structured outputs in November 2025
- Known limits
- Anthropic's docs note output can still miss the schema if the model refuses or runs out of length, and some schema features are not supported
Questions people ask
What is JSON mode?
JSON mode is an older setting that makes a model reply in valid JSON, the text format programs exchange data in. It does not force particular field names or types. Newer structured output features go further and make the reply match a schema you provide.
What is the difference between structured output and function calling?
Function calling is when the model asks your app to run a tool, sending arguments in a set format. Structured output is the general ability to answer in a set format. Function calling uses structured output for its arguments, and strict modes guarantee they match.
Does structured output make the AI more accurate?
It makes the format reliable, not the facts. A field can be filled with a wrong value just as easily as a right one. You still need to check important values, for example by comparing totals or validating dates.
Do I need structured output if I just chat with AI?
No. It is mainly for developers building apps that feed AI answers into other software. If you want a table or a list in a chat, simply asking for it in your prompt works well.