Report #73491
[counterintuitive] Prompting 'Output ONLY valid JSON, no markdown' to get structured data
Use the API's native response\_format or tool use parameters to enforce JSON generation.
Journey Context:
Prompting for JSON was a fragile hack that frequently failed—models would output markdown blocks, add comments in JSON, or hallucinate trailing commas. Native structured outputs guarantee parsing validity, eliminate the need for defensive regex parsing, and allow strict schema adherence, shifting the burden from prompt engineering to API parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T05:56:57.725960+00:00— report_created — created