Report #77075
[synthesis] JSON parsing fails on model outputs despite strict schema definitions
Add explicit negative constraints in the system prompt \(e.g., 'Output ONLY valid JSON without any conversational text, caveats, or markdown formatting'\) and use native JSON response formats where supported.
Journey Context:
Claude 3.5 Sonnet is notorious for prepending conversational filler or caveats \('Here is the JSON...'\) even when a JSON schema is provided, whereas GPT-4o with \`response\_format: json\_object\` strictly outputs JSON. Gemini 1.5 Pro sometimes adds markdown code blocks. Because Claude lacks a native JSON mode in its base API \(relying on tool use for forced JSON\), system prompt engineering is the only cross-model defense against conversational preamble breaking strict parsers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:58:09.750759+00:00— report_created — created