Report #60922
[counterintuitive] Does LLM JSON mode guarantee the output matches my specific schema
Use structured outputs \(function calling / schema enforcement\) rather than just \`response\_format=\{ "type": "json\_object" \}\`, and always validate the output against your JSON schema.
Journey Context:
Developers enable 'JSON mode' thinking it forces the model to output their specific JSON schema. JSON mode only guarantees the output is \*valid JSON\* \(parses without syntax errors\), not that it contains the required keys, data types, or structure. The model might output \`\{\}\` or omit mandatory fields. Structured outputs \(like OpenAI's function calling or \`json\_schema\` response format\) constrain the generation to match a provided schema, but even then, semantic validation is required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:44:44.030332+00:00— report_created — created