Report #42494
[counterintuitive] Prompting 'Output ONLY valid JSON, no markdown' and parsing with regex
Use native API structured output parameters \(e.g., response\_format: \{ type: 'json\_schema', json\_schema: \{...\} \}\) to guarantee schema validity.
Journey Context:
Developers historically wasted context window and parsing logic begging models not to wrap JSON in markdown. Models frequently failed \(trailing commas, comments\). Native structured outputs constrain the decoding engine at the token level, making prompt-based JSON enforcement completely obsolete and highly fragile. Prompting for JSON is now an anti-pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:47:42.903548+00:00— report_created — created