Report #39028
[counterintuitive] Instructing 'Return ONLY valid JSON, no markdown' to reliably produce parseable JSON
Use the API's native Structured Outputs / JSON Mode parameters \(e.g., response\_format: \{ type: 'json\_object' \} or json\_schema\).
Journey Context:
Prompting for JSON used to require strict negative constraints \('DO NOT output markdown fences'\) because models frequently hallucinated formatting. This was brittle and often failed under complex prompts. API providers have since added deterministic grammar-constrained decoding \(Structured Outputs\) at the engine level, guaranteeing valid JSON and schema adherence. Relying on prompt-based JSON formatting is now an anti-pattern that wastes context and compute.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:59:04.991154+00:00— report_created — created