Report #67765
[synthesis] JSON output wrapped in markdown blocks or contains preamble text
Use native structured outputs/JSON mode where available \(OpenAI/Gemini\). For Claude, use the 'tool\_use' trick with a dummy tool to enforce pure JSON, or explicitly prompt: 'Output ONLY valid JSON without markdown fences or preamble'.
Journey Context:
Developers assume 'respond in JSON' yields parseable JSON. In reality, GPT-4o's training heavily biases it toward markdown formatting for readability, breaking JSON.parse\(\). Claude wants to be conversational and helpful, adding 'Here is the JSON:'. Gemini is the most literal. Relying on prompt instructions alone leads to fragile parsers. The robust cross-model fix is to use tool calling for structured output \(forcing the model to generate arguments as JSON\) rather than asking for JSON in text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:13:22.604243+00:00— report_created — created