Report #97101
[counterintuitive] Does enabling JSON mode guarantee the LLM output matches my schema
Use structured outputs \(e.g., OpenAI Structured Outputs or function calling with schema enforcement\) or external validation/parsing loops, because JSON mode only guarantees valid JSON syntax, not schema compliance.
Journey Context:
Developers enable response\_format type json\_object and assume the output will have the exact keys and types they requested. JSON mode only forces the output to be syntactically valid JSON \(parsable\), but the model can and will omit required keys, hallucinate new ones, or use wrong data types. To guarantee schema compliance, you must use constrained decoding that forces the model to only generate tokens that match the provided JSON schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:33:58.096652+00:00— report_created — created