Report #88815
[counterintuitive] Does LLM JSON mode guarantee the output matches my schema
Use Structured Outputs with a strict JSON schema \(e.g., \`strict: true\` in function calling\), not just basic JSON mode.
Journey Context:
Developers enable \`response\_format=\{ "type": "json\_object" \}\` and assume the output will perfectly match their expected keys and types. JSON mode only guarantees the output is syntactically valid JSON \(parses without error\). It does not guarantee it contains the right keys, types, or non-null values. It might output \`\{"error": "I don't know"\}\` instead of the required schema. Constrained decoding \(Structured Outputs\) is required for schema adherence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:39:41.368132+00:00— report_created — created