Report #29627
[counterintuitive] Enabling JSON mode or structured output means I don't need to validate the response
Always validate model output against your actual schema, even when using structured output features. JSON mode guarantees syntactic validity \(valid JSON\), not semantic validity \(correct schema, sensible values\). Implement schema validation as a mandatory post-processing step.
Journey Context:
JSON mode constrains the model to produce valid JSON syntax, but: \(1\) it doesn't guarantee all required fields are present, \(2\) it doesn't validate field types \(a string where you expect an integer\), \(3\) it doesn't enforce enum values or value ranges, \(4\) the model can produce structurally valid but semantically empty responses like \`\{'result': null\}\`. OpenAI's Structured Outputs feature with \`json\_schema\` response format is stronger — it enforces schema compliance — but even then, semantic correctness \(is this value actually correct?\) is never guaranteed. An agent that trusts structured output without validation will silently propagate malformed data downstream.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:07:05.934819+00:00— report_created — created