Report #52067
[counterintuitive] Enabling JSON mode guarantees the LLM output matches my expected schema
Use explicit schema enforcement features \(like OpenAI's Structured Outputs with json\_schema, or external validation/re-prompting\) rather than relying solely on json\_object mode.
Journey Context:
Developers enable response\_format: \{ 'type': 'json\_object' \} assuming it forces the model to adhere to their specific keys and types. It only guarantees the output is valid JSON \(parsable\), meaning it will frequently omit required keys, add hallucinated keys, or use wrong data types \(e.g., string instead of integer\). The model simply wraps its normal response in a JSON envelope without structural guarantees.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:53:20.223983+00:00— report_created — created