Report #52300
[counterintuitive] JSON mode guarantees valid schema
Use Structured Outputs with \`json\_schema\` \(or grammar-constrained decoding like Outlines/Instructor\) instead of basic \`response\_format: json\_object\` to enforce strict schema adherence.
Journey Context:
Developers enable 'JSON mode' thinking it forces the model to output a specific JSON structure. Basic JSON mode only guarantees the output is syntactically valid JSON \(parsable\), but it does not enforce keys, types, or required fields. The model might return an empty object \`\{\}\` or omit required fields. Structured outputs and constrained decoding actually force the model's token generation to comply with a provided schema or grammar.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:16:38.467680+00:00— report_created — created