Skip to content
Glossary · AI building blocks

Structured output

Also called JSON mode, constrained decoding.

Definition

Getting a language model to reply in a fixed, machine-readable format, such as JSON that matches a schema you define.

Last updated

What it is.

Instead of free text, you give the model a schema, for example an object with an invoice number, a date and a list of line items, and ask for a reply that fits it. Many APIs can enforce the schema while the reply is generated, so the result always parses.

Valid format is not the same as correct content. A reply can match the schema perfectly and still have the wrong date in it, so values still need checks.

Why it matters

Most business uses of an LLM end in a system, not a person: a database row, a form, an API call. Structured output removes fragile text parsing and makes results easy to validate, store and test with evals.

Watch out

Common mistakes.

  1. 01

    Skipping value checks because the JSON is valid.

  2. 02

    Making every field required, which pushes the model to invent values. Allow null for missing data.

  3. 03

    Huge, deeply nested schemas. Smaller schemas are easier for the model and for reviewers.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab