Report #91517
[counterintuitive] Writing 'Return the response in JSON format' and manually parsing the output string
Use native Structured Outputs / JSON Mode with a provided schema \(e.g., Pydantic model or JSON Schema\) via the API parameters.
Journey Context:
In 2023, developers spent hours tweaking prompts \('Ensure valid JSON, no markdown fences'\) and writing fragile regex parsers. Modern APIs now guarantee 100% valid JSON adhering to a provided schema at the API level. Prompting for JSON is obsolete and fragile compared to API-level enforcement, which completely eliminates parsing errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:12:12.158795+00:00— report_created — created