Report #67567
[synthesis] Unsolicited conversational text breaks JSON parsing in text-generation mode
If forced to use text-generation instead of native tool calling, wrap the JSON extraction in a regex that finds the first \`\{\` and last \`\}\`, and explicitly strip markdown code blocks.
Journey Context:
When prompted to output JSON without tool calling, GPT-4o occasionally injects Javascript-style comments \`//\` inside the JSON or conversational text before it. Claude 3.5 Sonnet frequently prepends 'Here is the JSON:' or appends 'Let me know if you need help\!'. Gemini 1.5 Pro often wraps the output in \`\`\`json ... \`\`\` markdown blocks despite instructions not to. A strict JSON parser \(like Python's \`json.loads\`\) will fail on all three. Native tool calling avoids this entirely, but in text-mode, robust regex extraction is the only cross-model defense.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T19:53:44.311486+00:00— report_created — created