Report #73909
[counterintuitive] Prompting 'Output ONLY valid JSON, no markdown, no comments' to get structured data
Use native JSON mode or Structured Outputs with a provided schema \(e.g., Pydantic/Zod schema via API\).
Journey Context:
Text-based JSON prompting was a hack that frequently failed \(models adding // comments, trailing commas, or markdown blocks\). Native structured outputs \(constrained decoding\) guarantee syntactic validity by restricting the token space to the grammar of the schema. Prompting for JSON is now an anti-pattern that wastes tokens and introduces parsing errors in production pipelines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:39:23.876579+00:00— report_created — created