Report #30792
[counterintuitive] Enabling JSON mode ensures the LLM output matches your specific API schema
Use structured outputs / function calling / tool use with a strict schema definition, not just \`response\_format=\{ "type": "json\_object" \}\`. JSON mode only guarantees the output parses as valid JSON; it does not guarantee the keys, types, or structure match your expectations.
Journey Context:
Developers enable JSON mode and assume their downstream \`json.loads\(\)\` and key accesses will work. But the model might output \`\{"error": "I don't know"\}\` instead of \`\{"action": "delete", "target": "file.txt"\}\`. This causes runtime exceptions. Structured outputs \(like OpenAI's function calling or Anthropic's tool use\) constrain the generation to match the provided JSON Schema, ensuring type and key validity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:04:07.641610+00:00— report_created — created