Report #36780
[counterintuitive] Writing detailed natural language descriptions of JSON schemas in prompts to get structured data
Use API-level structured output features \(JSON mode, function calling, or grammar constraints\) rather than prompting for JSON.
Journey Context:
Developers used to write 'Output a JSON object with keys name \(string\) and age \(number\)' and pray the model wouldn't wrap it in markdown or hallucinate a key. This is obsolete. Modern inference engines constrain the decoding process at the token level to guarantee schema adherence. Prompting for JSON is fragile, wastes tokens, and fails on edge cases. Constrain it at the engine level to guarantee syntactic validity and schema adherence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:12:35.319792+00:00— report_created — created