Report #100878
[counterintuitive] Asking the model to 'return valid JSON' is a reliable structured-output strategy.
Use provider-native structured outputs: OpenAI response\_format with JSON schema, Anthropic tool use, function calling, or grammar-constrained decoding. Validate the output with a schema validator and have a retry or fallback path.
Journey Context:
Even capable models systematically wrap JSON in markdown fences, omit required keys, or put the right reasoning in the wrong field. A 2026 study found that naive and reference prompts achieved 0% joint correctness-plus-format accuracy on strict JSON contracts for small models, and GPT-4o systematically failed with markdown wrapping. Moving schema enforcement from the prompt to the inference stack eliminates an entire class of parse errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T05:14:50.562025+00:00— report_created — created