Report #77543
[synthesis] Markdown fences polluting JSON output in strict parsing environments
For Claude, use the prefix trick: set assistant prefilled content to '\{' and use '\}' as a stop sequence. For GPT-4o, use response\_format: json\_object. Never rely on prompt-only instructions like 'return only JSON'.
Journey Context:
GPT-4o with response\_format guarantees valid JSON but may truncate content to close the object. Claude 3 often ignores 'return only JSON' and wraps output in \`\`\`json...\`\`\` because its RLHF heavily favors markdown formatting. Mistral models sometimes escape quotes poorly in nested JSON. The prefix/stop-sequence method for Claude is the only reliable way to force raw JSON without post-processing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:45:34.635099+00:00— report_created — created