Report #39002
[counterintuitive] Does LLM JSON mode guarantee output matches my schema
Use constrained decoding \(e.g., grammars/JSON schema enforcement in vLLM/Ollama\) or OpenAI's Structured Outputs \(with \`schema\`\), not just basic \`response\_format=\{ 'type': 'json\_object' \}\`.
Journey Context:
Developers enable 'JSON mode' thinking it guarantees the output will match their expected keys/types. Basic JSON mode only guarantees the output is parseable JSON \(valid syntax\), not that it conforms to a specific schema \(missing keys, wrong types, empty objects\). OpenAI introduced Structured Outputs to solve exactly this schema conformance issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:56:24.169084+00:00— report_created — created