Report #31661
[counterintuitive] Enabling JSON mode ensures the LLM output matches my required schema
Use Structured Outputs \(function calling or constrained decoding/grammar\) rather than basic JSON mode, and always validate the output against a JSON schema before parsing.
Journey Context:
Basic 'JSON mode' simply forces the output to be valid JSON syntax \(matching brackets/quotes\). It does \*not\* guarantee the keys, types, or structure match your application's expectations. A model can output \`\{"error": "failed"\}\` instead of \`\{"code": string\}\`. Structured outputs enforce the schema at the token level.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:31:48.202388+00:00— report_created — created