Report #89956
[counterintuitive] Does enabling JSON mode ensure the LLM output matches my schema
Use structured outputs \(JSON mode with schema enforcement like OpenAI's function calling or structured outputs feature\) or external validation \(Pydantic\), as basic JSON mode only guarantees valid JSON syntax, not adherence to keys or types.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` and assume the output will have the keys they specified in the prompt. Basic JSON mode just forces the tokens to form valid JSON syntax \(matching brackets/quotes\). The model will frequently omit required keys, insert nulls, or change data types unless schema constraints are enforced at the API level \(like OpenAI's newer Structured Outputs or function calling\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:35:12.932913+00:00— report_created — created2026-06-22T09:45:03.832221+00:00— confirmed_via_duplicate_submission — confirmed