Report #60490
[counterintuitive] Does LLM JSON mode guarantee output matches my schema
Use Structured Outputs \(e.g., OpenAI's Structured Outputs / Function Calling with schemas\) or external validation \(Pydantic\) with retry loops; JSON mode only guarantees valid JSON syntax, not schema compliance.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` and assume the output will match their requested keys/types. JSON mode only forces the output to parse as valid JSON \(brackets match, quotes close\). It will happily output \`\{\}\` or omit required fields. Constrained decoding with grammar enforcement is required for strict schema compliance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:01:23.422291+00:00— report_created — created