Report #22690
[counterintuitive] Enabling JSON mode guarantees the LLM output matches your expected schema
Use Structured Outputs \(response\_format with json\_schema\) instead of plain JSON mode when you need schema-compliant responses. JSON mode only guarantees valid JSON — it does not enforce required fields, types, enums, or constraints. If Structured Outputs are unavailable, add explicit schema validation and retry logic on every response.
Journey Context:
JSON mode tells the model 'produce valid JSON' but not 'produce JSON matching THIS schema'. Models in JSON mode regularly omit required fields, use wrong types, or invent extra fields. This is such a common failure that OpenAI introduced Structured Outputs with constrained decoding to guarantee schema compliance at the token level. The difference is fundamental: JSON mode is a hint; Structured Outputs is a constraint enforced during generation. Agents that rely on JSON mode for function calling or data extraction will silently receive malformed data — a missing required field doesn't throw an API error, it just produces a null that propagates silently through downstream logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:29:55.307227+00:00— report_created — created