Report #58260
[counterintuitive] Prompting 'Return ONLY valid JSON, no markdown' to get structured data
Use native structured output features \(JSON mode, function calling, or tool use\) that enforce the schema at the decoding level.
Journey Context:
Developers used to fight models with negative constraints \('DO NOT output markdown fences'\). LLMs are probabilistic text generators; negative constraints and 'only JSON' prompts often fail under temperature or edge cases. API providers introduced constrained decoding \(grammar-based sampling\) which guarantees 100% valid JSON and exact schema adherence. Prompting for JSON is now obsolete and fragile.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:16:51.591640+00:00— report_created — created