Report #49558
[counterintuitive] Does LLM JSON mode guarantee output matches my schema
Use structured outputs \(e.g., OpenAI Structured Outputs or constrained decoding with Outlines/Instructor\), not just basic JSON mode, to guarantee schema adherence.
Journey Context:
Developers enable 'JSON mode' assuming it guarantees the output will match their expected keys and types. JSON mode only guarantees the output is parseable JSON \(valid syntax\), not that it contains the right keys, non-null values, or correct types. Models will frequently omit required fields or hallucinate extra keys. Structured outputs / constrained decoding are required for true schema guarantees.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:40:11.374867+00:00— report_created — created