Report #40250
[counterintuitive] Enabling JSON mode guarantees the LLM output matches my required schema and business logic
Use JSON mode only to guarantee syntactic validity, but always enforce semantic correctness \(e.g., allowed enum values, non-empty strings, logical constraints\) with a secondary schema validator like Pydantic, and handle retries programmatically.
Journey Context:
API providers introduced JSON mode to solve the frustration of malformed JSON outputs. Developers often conflate syntactic correctness with semantic correctness. An LLM in JSON mode will happily output valid JSON that completely ignores your required enum constraints, outputs empty strings for required fields, or hallucinates logically impossible combinations. Trusting JSON mode for data integrity leads to silent downstream failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:01:52.266421+00:00— report_created — created