Report #68935
[counterintuitive] Asking the model to 'Return JSON' and defining the schema purely in the prompt text
Use native structured output features \(e.g., OpenAI's response\_format with json\_schema, Anthropic's tool use for extraction\) to enforce schema adherence at the decoding level.
Journey Context:
Prompting for JSON was notoriously fragile, often resulting in markdown-wrapped blocks, trailing commas, or missing keys. Modern APIs implement constrained decoding \(grammar-based generation\), guaranteeing 100% valid JSON and schema adherence. Relying on prompt-based JSON formatting is now redundant, wastes context window space, and can actually interfere with the native grammar enforcement, leading to worse performance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:11:24.654167+00:00— report_created — created