Structured output (JSON, tables)
Asking AI to answer in a fixed format such as a table or JSON so results are easy to use.
What is it?
Structured output means the model answers in a predictable shape: a table with set columns, a checklist, or a data format like JSON that other software can read. Instead of free text, you describe the fields you need and the model fills them in.
Many AI APIs now offer a feature where developers provide a schema (a description of the exact fields and types) and the model's reply is constrained to match it. In everyday chat, a clear description and an example of the format usually works well.
Which models use it?
- OpenAI's API offers structured outputs that follow a JSON schema.
- Anthropic's and Google's APIs support JSON output and tool definitions with schemas.
- Chat assistants such as ChatGPT, Claude and Gemini can produce tables and lists on request.
- Spreadsheet and automation tools often pass AI output as structured data between steps.
How to use it
- Decide what fields you need and what each one means.
- Describe the format exactly, for example the column names or JSON keys.
- Show one short example of a correctly filled result.
- Say what to do when information is missing, such as leaving the field empty.
- In code, validate the output against the expected structure before using it.
- Check a sample of results by hand for accuracy, not just format.
Benefits
- Easy to paste into spreadsheets, databases or other apps.
- Consistent results across many requests.
- Makes comparison and review faster.
- Reduces manual copying and reformatting.
Limits and risks
- A correct format does not mean the content is correct.
- Without schema enforcement, the model may occasionally break the format.
- Forcing a rigid structure can drop useful nuance.
- Very large tables may be cut off if the reply hits the length limit.
Prompt template
Copy it, replace the parts in [brackets] and paste it into any AI chat.
Extract the following from the text below and return it as a table with these columns: [column 1], [column 2], [column 3]. Use one row per [item]. If a value is not in the text, write "not stated" instead of guessing. After the table, list anything that was unclear. Text: [paste text]
More in Using AI well
- Prompt engineeringWriting clear instructions so an AI model gives you useful, accurate results.
- Context engineering and system promptsGiving an AI the right background, rules and role before the task, so it behaves consistently.
- Planning and step-by-step reasoningGetting better answers on complex problems by having the model plan and work in steps.