Report #81342
[counterintuitive] JSON mode guarantees valid schema
Use Structured Outputs \(function calling or json\_schema response format\) rather than basic JSON mode to guarantee schema adherence.
Journey Context:
Developers enable \`response\_format: \{ "type": "json\_object" \}\` assuming it forces the LLM to output JSON matching their required keys. Basic JSON mode only guarantees the output is syntactically valid JSON \(parses without error\); it does not guarantee the presence of specific keys, correct data types, or non-null values. The model might output \`\{\}\` or omit required fields. To enforce actual schema constraints, providers have introduced constrained decoding \(Structured Outputs\) which restricts the token generation to strictly follow a provided JSON schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:08:00.052998+00:00— report_created — created