Report #55286
[synthesis] JSON output parsing fails due to markdown wrappers or invalid syntax
Always use a regex or string stripper to remove \`\`\`json and \`\`\` before parsing. For Gemini, run a pre-parser to remove trailing commas and JS-style comments. For GPT-4o, use JSON mode \(response\_format: json\_object\) if available, but for cross-model, aggressive stripping is mandatory.
Journey Context:
Developers write JSON.parse\(output\) and it works for GPT-4o in JSON mode, but breaks on Claude because of markdown blocks, and breaks on Gemini because of trailing commas. The synthesis is that no model is 100% compliant with raw string JSON output without defensive parsing. Claude's markdown is a feature for human readability, but a bug for machines. Gemini's trailing commas are a known pre-training artifact.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:17:22.704120+00:00— report_created — created