Report #84790
[counterintuitive] Relying on prompt text like 'Output ONLY valid JSON' to get structured data
Use native API structured output features \(e.g., response\_format: \{ type: 'json\_object' \} or json\_schema\) with a defined schema.
Journey Context:
Prompting for JSON was a fragile hack before APIs supported it natively. It frequently failed \(markdown blocks, comments, invalid syntax\) and required defensive regex parsing. Native structured outputs constrain the decoding process at the API level, guaranteeing syntactic validity and schema adherence, eliminating the need for brittle output parsing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:54:43.535641+00:00— report_created — created