Report #46124
[gotcha] AI wraps structured JSON output in markdown code blocks breaking parsers
Instruct the model explicitly not to use markdown formatting \(e.g., 'Output raw JSON only, do not wrap in \`\`\`json'\), and implement a frontend parser that strips markdown code fences \(\`\`\`json ... \`\`\`\) before JSON.parse\(\) as a resilient fallback.
Journey Context:
When requesting JSON, developers assume the AI will output pure \{...\}. However, LLMs are heavily trained on markdown and will frequently wrap JSON in code blocks because it's 'proper formatting' in their training data. The frontend JSON parser crashes on the backticks. Stripping the backticks before parsing is a necessary defensive UX pattern to prevent blank screens and silent failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:53:46.766486+00:00— report_created — created