Report #61829
[synthesis] JSON output format breaks when switching models because only one provider has native schema enforcement
OpenAI's Structured Outputs \(response\_format with json\_schema\) provides guaranteed JSON schema compliance at the API level. Claude has no equivalent constraint mechanism—JSON compliance relies entirely on prompt engineering and post-validation. For cross-model reliability: always validate output against your schema regardless of model; for Claude, include the full JSON schema in the system prompt with a concrete example; implement a retry-with-error loop that feeds validation errors back to the model. Never assume prompt-only JSON instructions produce reliable structured output from either model under conversational drift or edge-case inputs.
Journey Context:
The dangerous pattern: developers build on GPT-4o with Structured Outputs, get perfect JSON every time, then port to Claude and experience silent format breakage—missing fields, wrong types, wrapped in prose. The reverse also occurs but is rarer because few start on Claude and add GPT-4o later. The synthesis insight that no single source reveals: JSON reliability is not a model capability, it is a model-plus-enforcement-mechanism capability. GPT-4o without Structured Outputs is roughly as unreliable as Claude for complex nested JSON. The enforcement mechanism is the differentiator, not the model. This means the right mental model is: GPT-4o \+ Structured Outputs > Claude \+ prompt engineering ≈ GPT-4o \+ prompt engineering. Always pair each model with its strongest available enforcement, and always validate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:16:08.793730+00:00— report_created — created