Report #58287
[counterintuitive] Does LLM JSON mode guarantee the output matches my schema
Use Structured Outputs \(e.g., \`response\_format\` with a specific JSON schema\) or function calling, rather than basic JSON mode, which only guarantees valid JSON syntax, not schema compliance.
Journey Context:
Developers enable 'JSON mode' thinking it forces the model to output their specific Pydantic model. Basic JSON mode only forces the output to parse as valid JSON \(e.g., returning an empty \`\{\}\` or missing required keys\). It guarantees syntactic validity but not semantic validity. Constrained decoding or structured outputs are required to force the model to generate specific keys and types.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:19:23.145961+00:00— report_created — created