What are structured outputs? Explained with a form instead of a letter
Structured outputs make an AI model answer in a fixed format you define, such as named fields, so software can read every answer. Think of handing a clerk a form to fill in instead of asking for a letter.
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- AI
In one sentence: Structured outputs are a setting that makes an AI model answer in a fixed format you define in advance, such as a set of named fields, so your software can read every answer without guessing.
The everyday picture
Imagine you ask an office clerk to tell you about a new customer. If you say "write me a note", you get a letter. One day it starts with the name. Another day the phone number is buried in the third paragraph. Sometimes the email address is missing.
Now hand the same clerk a printed form. It has a box for the name, a box for the phone number, a box for the email and a tick box for "urgent: yes or no". The clerk can only write inside the boxes. Every form comes back with the same boxes in the same place.
That is the difference structured outputs make. Without them, an AI model writes a letter. With them, it fills in your form. The form is called a schema: a list of the fields you want, what type each one is, and which ones must be filled.
You hand the model (the clerk) a blank form (the schema). It can only write inside the boxes, so the answer always comes back in the same shape. Your own checks then catch wrong values before the data is filed.
How it works, step by step
- You design the schema (you print the blank form). It lists each field, such as "customer_name" as text, "order_total" as a number and "category" as one of a fixed list of choices. Most providers use a common format for this called JSON Schema.
- You send the schema with your request (you hand the clerk the form along with the customer's email). Your instructions still matter: they tell the model what goes in each box.
- The model fills in only the allowed shape (the clerk can only write inside the boxes). Anthropic's documentation says Claude's structured outputs guarantee schema-compliant responses through "constrained decoding". In plain words, while the model writes, the system blocks any next word that would break the form.
- The answer comes back as JSON (the filled form comes back). JSON is a simple text format of names and values that almost all software can read, like
"urgent": true. - Your software checks and files it (someone checks the form before it goes in the cabinet). The fields drop straight into your database, spreadsheet or next step, and your own rules catch anything the form cannot.
Try it · Side by side
Letter or form: which should you ask the AI for?
Tap what matters to you (pick one or more) and see which option fits.
Free text (a letter)
- Natural and easy to read, with room to explain.
- Software must hunt for values that move around.
- Free to write whatever the task needs.
- Fields can be missing or renamed.
- Just write the instructions.
Structured output (a form)
- Readable, but feels like a list of fields.
- Every value sits in a named box, every time.
- Boxes can squeeze out useful detail.
- Required boxes are always filled.
- Someone must design the form (schema) first.
Pick what matters to you and the better fit lights up.
There is an older, weaker setting called JSON mode. OpenAI's guide explains that JSON mode only makes sure the answer is valid JSON, while structured outputs also make sure it matches your schema. Think of JSON mode as "write on lined paper" and structured outputs as "fill in this exact form".
Where the picture stops
- A clerk who does not know the answer can leave a box blank. A model forced to fill a required box will put something there, even a guess. The form guarantees the shape, not the truth, so add an "unknown" choice where it makes sense.
- A paper form accepts any handwriting. AI providers support only part of JSON Schema, and some rules (like a maximum text length) may be rejected or ignored, so very complex forms can fail.
- A clerk always hands the form back. A model can still refuse a request for safety reasons, or stop early if it hits its length limit. Both Anthropic and OpenAI say your software should check for these cases before reading the fields.
Try it · Myth or fact
Structured outputs: myth or fact?
Decide for yourself first, then tap each statement to check it.
0 of 3 checked
Why it matters for your business
- Fewer broken automations. Anthropic lists the problems this removes: invalid JSON, missing required fields, wrong data types, and the retries those cause.
- Faster hand-offs. Invoices, emails and forms can go from AI straight into your CRM or accounting system without someone copying values across.
- Simpler instructions. OpenAI notes you no longer need strongly worded prompts just to get consistent formatting.
- Risk stays with you. OpenAI's guide says your app still needs to validate any business rules the schema does not express. A well-shaped answer can still be wrong.
An example
Imagine a 15-person property management company that gets 200 repair requests a week by email. Today, an office manager reads each one and types the address, the problem and the urgency into a spreadsheet.
They set up an AI step with a schema: "property_address" (text), "issue_type" (one of plumbing, electrical, heating, other), "urgent" (yes or no) and "tenant_phone" (text or "unknown"). Every email now comes back as the same filled form, ready for the spreadsheet. The manager reviews the urgent ones and spot-checks the rest, because a correct shape does not mean a correct reading of the email.
Frequently asked questions
Is structured output the same as JSON mode?
No. JSON mode only promises valid JSON. Structured outputs also promise that the answer follows your schema, with the fields and types you defined.
Does structured output stop AI hallucinations?
No. It controls the format, not the facts. A model can still put a wrong value in the right box, so check important fields.
Which AI models support structured outputs?
Anthropic (Claude), OpenAI and Google (Gemini) all document structured outputs for their current models. Each supports a slightly different part of JSON Schema, so check your provider's docs.
Do I need a developer to use structured outputs?
Usually, yes, or a no-code tool that offers it. Someone has to design the schema and connect the filled forms to your other systems.
Related explainers
- What is AI classification? Explained with a post room
- What is tool use in AI? Explained with a calculator in an exam
- What is Document AI? Explained with a mailroom clerk
- What are AI hallucinations? Explained with a confident quiz guess
The DevDrift builds AI automation that passes clean, checked data into your systems: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.