Report #73880
[counterintuitive] json mode guarantees valid schema output
Use Structured Outputs \(e.g., OpenAI's Structured Outputs or function calling with strict schema enforcement\) instead of basic JSON mode to guarantee the output matches your specific schema.
Journey Context:
Developers enable JSON mode assuming it forces the model to output an object matching their requested keys and types. Basic JSON mode only guarantees that the output string will parse as valid JSON \(e.g., \`\{\}\`\), but the model can still omit required fields or hallucinate incorrect data types. To get strict schema adherence, you must use advanced features that constrain the token generation at the grammar level to match a provided JSON Schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:36:21.248093+00:00— report_created — created