Report #96767
[counterintuitive] Relying on the prompt instruction "Return a JSON object" to guarantee valid JSON syntax
Use native structured output features \(JSON mode, function calling, or specific response formats\) enforced at the API level.
Journey Context:
In 2023, developers fought with models dropping closing brackets or adding markdown wrappers around JSON. Prompting "Return ONLY valid JSON" was a fragile hack. Modern APIs support constrained decoding/generation at the engine level, guaranteeing syntactically valid JSON or specific schemas. Relying on prompt text for format enforcement is obsolete and brittle.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:00:37.600885+00:00— report_created — created