Report #68083
[counterintuitive] Writing 'Output ONLY valid JSON, no markdown' in the prompt to get structured data
Use the API's native structured output / JSON mode parameter \(e.g., response\_format: \{ type: 'json\_object' \} or json\_schema\).
Journey Context:
Prompting for JSON was a hack before API support existed. It frequently failed \(adding markdown fences, trailing commas, comments\). Native JSON mode guarantees grammatical validity. Note that json\_object doesn't guarantee schema adherence; json\_schema \(Structured Outputs\) does.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:45:33.284345+00:00— report_created — created