Report #35062
[counterintuitive] Enabling JSON mode ensures the LLM output matches my schema
Use Structured Outputs \(e.g., \`response\_format\` with a JSON schema\) or strictly validate the output against your schema with a retry loop, because JSON mode only guarantees valid JSON syntax, not semantic schema adherence.
Journey Context:
Developers enable JSON mode \(\`response\_format: \{ "type": "json\_object" \}\`\) assuming it forces the model to output the exact keys and types they specified in the prompt. In reality, JSON mode only guarantees the output is parseable JSON \(e.g., \`\{\}\`\). The model frequently omits required fields or hallucinates extra keys. The model does not natively compile the prompt's schema description into a grammar constraint unless using explicit Structured Outputs features.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:19:48.701731+00:00— report_created — created