Report #85696
[counterintuitive] Appending 'Respond in JSON' or 'Output only valid JSON' to a prompt guarantees structured output
Use the API's native JSON mode or Structured Outputs parameter \(e.g., response\_format in OpenAI\) rather than prompt engineering.
Journey Context:
Prompting for JSON was a necessary hack before API support existed. It frequently failed due to markdown wrappers, escaping errors, or truncated JSON causing parsing exceptions. Native JSON mode and Structured Outputs enforce grammar at the token generation level, guaranteeing valid JSON. Prompting for JSON is now obsolete, fragile, and wastes input/output tokens.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:25:26.149913+00:00— report_created — created