promptgarten 🌱
🌍 ES
Term●●○3 min Β· +25 XP

Structured outputs

Structured outputs force an AI to deliver its answer in a fixed format – e.g. valid JSON following a given schema.

The problem

By default, an LLM answers in free-flowing text. But if you want to process the answer further in your code – say, write it to a database or pass it to another function – you need a reliable, machine-readable format instead of prose that's structured differently every time.

What structured outputs does

Structured outputs is an API feature that ties a model's output to a given schema, usually JSON Schema. Instead of hoping the model sticks to a format, generation is technically constrained so that only schema-compliant outputs are possible.

A related approach: tool use

With Claude, you often achieve similarly reliable, structured outputs via tool use: you define a "tool" with a fixed input schema, and the model fills in that schema instead of writing free text.

What this is used for

  • Extracting data from documents (names, amounts, dates) for further processing
  • Function calling / tool use in agent systems
  • Building reliable pipelines that don't crash on every small formatting slip

EXAMPLE

Instead of 'The customer's name is Max Mustermann and he ordered on May 3rd', structured outputs delivers directly: {"name": "Max Mustermann", "order_date": "2026-05-03"}

QUICK QUIZ

Why are structured outputs useful for code pipelines?

SOURCES

RELATED TOPICS

What Is an API? (Explained Without Jargon) ●○○MCP (Model Context Protocol): How AI Tools Connect ●●○What Is a Prompt? ●○○