Report #61916
[counterintuitive] JSON mode guarantees schema valid output
Use Structured Outputs \(strict mode\) or function calling with schema enforcement, not just JSON mode, to guarantee keys and types.
Journey Context:
Developers enable JSON mode assuming the output will match their expected schema \(e.g., always having a 'name' string and 'age' integer\). JSON mode only guarantees the output is parseable JSON \(no syntax errors\). The model can still omit required keys, hallucinate extra keys, or pass a string where an integer is expected. To guarantee schema adherence, you must use features that enforce the schema at the token level, like OpenAI's Structured Outputs with strict:true or constrained decoding engines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:24:57.158558+00:00— report_created — created