Report #41098
[counterintuitive] enabling json mode guarantees valid schema
Use Structured Outputs \(JSON Schema enforcement\) or implement Pydantic validation with retries; JSON mode only guarantees valid JSON syntax, not schema compliance.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` assuming it will force the model to output the exact keys and types they specified in the prompt. In reality, JSON mode only forces the output to parse as valid JSON \(no syntax errors\). The model can still omit required keys, output wrong data types, or hallucinate extra keys. True schema enforcement requires using the newer Structured Outputs feature or external validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:27:10.702931+00:00— report_created — created