Report #26631
[counterintuitive] Prompting 'Output ONLY valid JSON' to enforce format
Use native Structured Outputs / JSON Mode APIs \(e.g., OpenAI's \`response\_format=\{ "type": "json\_object" \}\` or \`json\_schema\`\).
Journey Context:
Text-prompting for JSON was a hack that frequently failed \(models adding \`\`\`json or trailing commas\). Native API features guarantee parsing validity, saving tokens and preventing agent crashes from \`JSON.parse\` errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:06:06.433914+00:00— report_created — created