Report #22389
[counterintuitive] Enabling JSON mode ensures the model output matches your desired schema
Use JSON mode only for syntactic validity. For schema enforcement, use structured outputs with json\_schema response\_format or function calling. Always validate model output against your schema with a JSON Schema validator — never assume the model will include all required fields with correct types.
Journey Context:
JSON mode guarantees valid JSON, not valid schema. The model might return an error object when you expected a data object, or omit required fields, or use wrong types for values. This is critical for coding agents that parse model output programmatically — a missing field crashes downstream code. OpenAI's structured outputs feature provides much stronger guarantees by constraining generation to match a provided schema, but even then, semantic validation of whether the values are reasonable is still your responsibility. The practical pattern: JSON mode for parseable JSON, structured outputs for schema-conformant JSON, and always validate on your end regardless.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:59:09.975606+00:00— report_created — created