Sistava

What is Structured Output?

Also called structured outputs, JSON mode.

Structured output is model output constrained to a predefined machine readable format, most often JSON matching a supplied schema, instead of free form prose. Some providers enforce this during generation so the result is guaranteed to parse and conform, while weaker approaches merely request the format in the prompt and validate afterwards.

Strict enforcement works by restricting which tokens the model may produce at each step, so that the output can only follow a path the grammar allows. This is often called constrained decoding. Because invalid continuations are never sampled at all, conformance becomes structural rather than probabilistic, and the retry loops that once handled malformed JSON disappear entirely.

Most useful applications need to put model output into a database row, an API call, or a user interface component. Free text requires brittle parsing that breaks on a stray apostrophe or an unexpected introductory sentence. A guaranteed shape removes an entire class of production failure and makes a model call composable with ordinary typed code.

The most important limit is that structure is not accuracy. A guaranteed schema will happily return a well formed date that never existed. Enforcement also interacts with quality, because very rigid or deeply nested schemas can push a model into filling required fields with plausible filler rather than admitting uncertainty. Allowing explicit null or unknown values is usually worth the extra field.

Structured output and function calling share the same schema machinery and are sometimes the same API feature. The distinction is intent: function calling asks for an action to be performed, while structured output asks for an answer in a given shape. Formatting requests made only in the prompt are a third and weaker option that should always be validated rather than trusted.

Key points

In practice

A recruiting tool asks a model to read a resume and return a candidate record with a name, years of experience as an integer, and a list of skills. With enforcement on, the reply always parses and always carries those three fields, so it can be written straight into a table. If the resume never states a total, the model sets that field to null, which the schema allows, instead of inventing a number.

Related terms

Back to the AI Glossary