Report #40977
[synthesis] JSON vs XML formatting preferences causing extraction instability
Use JSON for GPT-4o \(leveraging \`response\_format\`\), but use XML tags for Claude 3.5 Sonnet for maximum reliability and reduced hallucination in extraction tasks.
Journey Context:
Developers often standardize on JSON for all LLM interactions because it is native to APIs. However, GPT-4o was heavily fine-tuned on JSON and handles it natively, whereas Claude was trained with a heavy emphasis on XML \(as seen in Anthropic's own prompt library\). Asking Claude for complex JSON extraction often leads to formatting errors, whereas XML tags naturally constrain its generation and reduce hallucination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:15:06.856370+00:00— report_created — created