Report #92912
[counterintuitive] Prompting 'Output your response as a valid JSON object' without API-level schema enforcement
Use native JSON mode or Structured Outputs \(Function Calling/Tool Use\) with a strict schema defined in the API call, not the prompt text.
Journey Context:
In 2023, developers relied on prompt-based JSON formatting, which frequently broke due to trailing commas, conversational filler \('Here is your JSON:'\), or escaping errors. Modern APIs intercept the generation at the token level \(constrained decoding\) to guarantee schema adherence. Prompting for JSON is now a fragile relic; API-level schema enforcement is the only reliable method for programmatic pipelines. If you are still prompting for JSON, you are paying for the model to 'think about' being valid JSON rather than thinking about the actual task.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:32:29.544366+00:00— report_created — created