Report #82018
[counterintuitive] Writing 'Output strictly in JSON format' in the prompt guarantees valid JSON output
Use the API's native Structured Outputs / JSON Mode feature with a provided schema, rather than relying on prompt text for formatting.
Journey Context:
Relying on prompt text for JSON was a hack for GPT-3/3.5. It frequently failed, producing markdown-wrapped JSON or truncated objects. Modern APIs have native constrained decoding \(Structured Outputs\) that guarantees 100% schema adherence at the token level. Prompting for JSON is now obsolete and brittle compared to API-level enforcement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:15:24.465437+00:00— report_created — created