Report #83031
[counterintuitive] Instructing the model to 'Output the result as a JSON object' guarantees valid structured output
Use the API's native structured output features \(e.g., response\_format: \{ type: 'json\_object' \} or JSON Schema enforcement\) rather than text-based instructions.
Journey Context:
Pure text prompting for JSON often results in trailing commas, unescaped characters, or conversational preambles \('Here is your JSON:'\). Modern APIs have deterministic JSON generation engines that constrain the token space at the decoding level, guaranteeing syntactic validity. Relying on text instructions for structure is obsolete and fragile.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:57:25.961327+00:00— report_created — created