PromptForge
AI Glossary

Prompting techniques

Structured output

Also known as: json mode, structured outputs

Definition

Structured output means constraining a model to return data in a machine-readable shape such as JSON, usually by specifying the exact schema in the prompt or using a provider feature that enforces it.

When a program consumes model output, free text is a liability. Structured output solves this by pinning down the exact keys, types and permitted values you expect.

The most reliable approach is showing the literal schema in the prompt — models follow explicit key names far more consistently than prose descriptions. Several providers now offer schema enforcement (JSON mode, function calling, structured outputs) that guarantees valid, conforming JSON rather than merely requesting it.

Common failure modes without enforcement: markdown code fences wrapped around the JSON, trailing commas, and explanatory text before or after the object. Asking for "valid JSON only, no markdown" prevents most of them.

Example

Return JSON only, matching: {"title": string, "company": string, "salary_range": string | null, "remote": boolean}

Related terms

Put this into practice

Understanding the term is step one. Our free courses and tools let you actually use it.