Report #75776
[counterintuitive] Prompting 'Output ONLY valid JSON, no markdown, no trailing commas' to get structured data
Use the API's native JSON mode or structured outputs with a provided schema \(e.g., response\_format: \{ type: json\_object \}\).
Journey Context:
Developers waste tokens begging the model not to wrap JSON in markdown blocks. Instruction-tuned models try to be helpful and sometimes add conversational filler. Native JSON mode guarantees valid syntax by constraining the token generation space at the grammar level, making prompt-based JSON enforcement obsolete.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:47:06.707775+00:00— report_created — created