Report #79148
[counterintuitive] Does enabling JSON mode guarantee the LLM output matches my schema
Use constrained decoding \(e.g., grammars/JSON schema enforcement in vLLM/Outlines\) or strict structured output APIs \(like OpenAI's Structured Outputs with \`json\_schema\`\) rather than basic \`response\_format: \{ "type": "json\_object" \}\`.
Journey Context:
Developers enable basic 'JSON mode' and assume the output will perfectly match their expected keys and types. Basic JSON mode only guarantees the output parses as valid JSON, not that it contains the required keys, correct data types, or valid enums. The model can still output \`\{"error": "I don't know"\}\` instead of the expected schema. Constrained decoding or strict structured output APIs are required for actual schema adherence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:26:45.854741+00:00— report_created — created