Structured Output
Overview
Structured output allows you to make a model return data in a predefined JSON format instead of normal text.
- Useful for automation
- Makes output easier to process
This is especially useful when the model output will be consumed by another application, script, API, or workflow instead of being read directly by a person.
Using JSON
JSON (JavaScript Object Notation) is a text-based format used to store and exchange structured data.
- Commonly used by APIs
- Easy to parse in code
In the example below, the model is asked to summarize financial data from a document. The output is free-form text:
The company generated $1,000,000 in revenue and $250,000 in operating income during 2025.
This is easy for a person to read but may be harder for another application to process. We can enable Structured Output to make the model return the same information in a structured JSON format.
{
"year": "2025",
"revenue": 1000000,
"operating_income": 250000
}
This format is easier to use in programs, APIs, databases, and automation workflows.