Report #59593
[counterintuitive] enabling JSON mode ensures valid API responses
Use structured outputs \(JSON Schema enforcement\) or always validate the LLM output against a strict schema \(e.g., Pydantic\) on the client side, because JSON mode only guarantees syntactic validity, not semantic validity.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` and assume the output will match their expected schema. JSON mode only forces the output to be parseable JSON \(e.g., \`\{\}\`\). It does not guarantee the presence of required keys, correct data types, or adherence to enums. The model can still output \`\{'error': 'I don't know'\}\` instead of the expected \`\{'answer': string\}\`. Structured Outputs were introduced to solve this exact limitation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:31:08.459917+00:00— report_created — created