# Structured output

> Getting a model to answer in a fixed, machine-readable format — JSON, a table, labelled fields — instead of free-form prose.

Source: Promptea — https://www.promptea.me/en/glossary/structured-output · Language: English · Last updated: 2026-11-09

## What it means

- Definition: structured output means the answer follows a predefined shape that a program (or a reader in a hurry) can rely on. JSON is the most common, but a fixed list of headings or a table counts too.
- Why it matters: free text is hard to parse and varies between runs. A fixed structure makes downstream code simple and results comparable.
- How to apply it: describe the exact shape (keys and types or the column names), say what to do with missing values, and say 'return only this format'. Where the model or API has a native structured-output mode, use it — it is stronger than asking in prose.
- Always validate. A response can be well-formed and still wrong, so check types, ranges and required fields before using it.

## Example

```text
Classify each support ticket. Return ONLY a JSON array; one object per ticket:
{"id":"string","category":"billing|bug|feature_request|other","urgency":"low|medium|high","summary":"max 15 words"}
If a ticket is unclear, use category "other" and urgency "low". No markdown, no commentary.

Tickets:
"""[paste]"""
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=Classify+each+support+ticket.+Return+ONLY+a+JSON+array%3B+one+object+per+ticket%3A%0A%7B%22id%22%3A%22string%22%2C%22category%22%3A%22billing%7Cbug%7Cfeature_request%7Cother%22%2C%22urgency%22%3A%22low%7Cmedium%7Chigh%22%2C%22summary%22%3A%22max+15+words%22%7D%0AIf+a+ticket+is+unclear%2C+use+category+%22other%22+and+urgency+%22low%22.+No+markdown%2C+no+commentary.%0A%0ATickets%3A%0A%22%22%22%5Bpaste%5D%22%22%22&purpose=data&target=gemini)

## Frequently asked questions

### Do all current models support native structured output?

No. It depends on the model and API. Promptea's models pages show, for each current model, whether the provider's documentation lists structured output, with its verification date.

### What if the model adds text around the JSON?

Say 'return only JSON, no markdown, no commentary', give one example, and parse defensively (retry or repair on failure) instead of assuming perfect output.

## Related

- [How to force valid JSON output (no markdown)](https://www.promptea.me/en/guides/json-output)
- [Structured output prompting: how to get reliable JSON, tables, and lists from any AI](https://www.promptea.me/en/guides/structured-output-prompting)
- [Few-shot prompting: how to show examples instead of just explaining](https://www.promptea.me/en/guides/few-shot-prompting)
- [JSON schema](https://www.promptea.me/en/glossary/json-schema)
- [Few-shot prompting](https://www.promptea.me/en/glossary/few-shot)
