JSON Schema mode (strict)
JSON Schema mode is the API feature — OpenAI strict mode, Anthropic tool-use schemas, Gemini response_schema — that constrains a language model's output to match a supplied JSON Schema at decode time.
In more detail
What it means
Standard JSON mode forces valid syntax but allows the model to invent fields. JSON Schema mode (strict) additionally enforces the field shape: required keys, field types, allowed enums, nested object structure. The decoder cannot emit output that violates the schema. Production LLM apps in 2026 default to JSON Schema mode for any output downstream code parses — extraction, classification, tool-call arguments. Trade-off: deep unions or recursive schemas can confuse smaller models; keep schemas reasonably flat.
Part 1 of 2
When to use it, and when not
Use it for
- Production extraction tasks.
- Tool / function call arguments.
- Anywhere code downstream parses the model's output.
Part 2 of 2
Common mistakes
- Deeply nested optional fields — smaller models drift on shape.
- Skipping schema validation server-side — strict mode reduces but does not eliminate edge-case failures.
FAQ
Questions readers ask.
What is json schema mode (strict)?
JSON Schema mode is the API feature — OpenAI strict mode, Anthropic tool-use schemas, Gemini response_schema — that constrains a language model's output to match a supplied JSON Schema at decode time.
When should you use json schema mode (strict)?
Production extraction tasks. Tool / function call arguments. Anywhere code downstream parses the model's output.
What are the common mistakes with json schema mode (strict)?
Deeply nested optional fields — smaller models drift on shape. Skipping schema validation server-side — strict mode reduces but does not eliminate edge-case failures.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/json-schema-mode.md. Found a mistake? Tell us.