Report #47962
[counterintuitive] Does LLM JSON mode guarantee the output matches my schema
Use structured outputs \(function calling / constrained decoding\) with a provided JSON Schema, rather than just setting \`response\_format: \{ "type": "json\_object" \}\`.
Journey Context:
Developers enable 'JSON mode' thinking it forces the model to output the exact keys/types they want. JSON mode only guarantees the output is syntactically valid JSON \(parses without error\), not that it conforms to the desired schema \(e.g., it might output \`\{ "error": "I don't know" \}\` instead of the required \`\{ "name": string, "age": int \}\`\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:58:57.668456+00:00— report_created — created