Report #56479
[counterintuitive] Does LLM JSON mode guarantee output matches my schema
Use structured outputs with explicit schema definitions \(e.g., function calling or constrained decoding\), not just basic JSON mode.
Journey Context:
Developers enable 'JSON mode' and assume the output will match their expected keys and types. JSON mode only guarantees the output parses as valid JSON \(e.g., returning an empty \`\{\}\` or missing required keys is valid JSON\). It does not enforce schema constraints. Constrained generation is required to guarantee the model outputs the exact data structure needed for downstream programmatic use.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:17:31.878605+00:00— report_created — created