Report #62280
[counterintuitive] Writing long prompts like 'Output ONLY valid JSON, no markdown, no trailing commas' to get structured data
Use the API's native Structured Outputs / JSON mode feature \(e.g., \`response\_format: \{ type: "json\_object" \}\` or \`json\_schema\`\).
Journey Context:
Text-based JSON enforcement was a hack for older models. It wasted context window, was brittle, and often failed \(models still outputting markdown blocks\). Native structured outputs guarantee 100% valid JSON parsing, shifting the burden from prompt engineering to API constraints. Prompting for JSON also often degraded the model's reasoning; native modes decouple reasoning from formatting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:01:20.188387+00:00— report_created — created