Report #63556
[synthesis] JSON output wrapped in markdown or mixed with conversational text breaking strict parsers
Always use explicit output parsing logic \(regex or code\) to strip markdown fences and conversational text, OR use native structured output features \(JSON mode / tool use\) rather than relying on prompt-based JSON generation.
Journey Context:
A common mistake is assuming 'Output only JSON' guarantees raw JSON. Cross-model testing reveals this is highly unreliable. GPT-4o's markdown wrapping and Claude's conversational prefixes will break JSON.parse\(\). Relying on native JSON modes \(OpenAI's response\_format: \{ type: 'json\_object' \}, Anthropic's tool-use forcing\) or robust post-processing \(stripping \`\`\`json and text before \{ and after \}\) is the only resilient cross-model pattern.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:09:55.297022+00:00— report_created — created