Report #42237
[counterintuitive] enabling json\_mode guarantees valid application schema
Always validate the LLM's JSON output against your application's specific schema \(e.g., using Pydantic or Zod\); \`json\_mode\` only guarantees valid JSON syntax, not correct keys or types.
Journey Context:
Developers enable \`response\_format=\{ 'type': 'json\_object' \}\` and assume their downstream code won't crash on missing keys or wrong data types. \`json\_mode\` merely forces the model's output to be syntactically valid JSON \(matching brackets, quotes\). The model can still omit required fields, hallucinate extra fields, or put strings where integers are expected. Structured outputs are better, but schema validation remains mandatory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:21:59.311795+00:00— report_created — created