Report #71661
[counterintuitive] Prompting 'Return ONLY valid JSON, no markdown' to get structured data from LLMs
Use native structured output features \(JSON mode, Structured Outputs, tool use\) or specific pre-fill tokens.
Journey Context:
Prompting for JSON often results in markdown-wrapped JSON, truncated JSON due to token limits, or escape character errors that break parsers. Native structured output features constrain the decoding process at the API level, guaranteeing schema validation and preventing format drift without wasting prompt tokens on begging.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:51:43.163643+00:00— report_created — created