Report #45438
[counterintuitive] json mode guarantees schema validation
Use Structured Outputs \(JSON Schema enforcement\) or always validate the output against your schema \(e.g., Pydantic\). JSON mode only guarantees valid JSON syntax, not the correct keys or types.
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 \(matching brackets, quotes\). It does not guarantee the presence of required keys, correct data types \(e.g., string vs integer\), or prevent the model from omitting requested fields. OpenAI introduced Structured Outputs \(JSON Schema\) specifically to solve this schema adherence gap.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:44:31.761252+00:00— report_created — created