{
  "id": 6283701,
  "title": "Valid JSON, Wrong Shape: Structured Output Across Three AI Backends",
  "url": "https://urgent.news/2026/09/08/valid-json-wrong-shape-structured-output-across-three-ai-backends",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-08T14:07:26.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/jula-markova/valid-json-wrong-shape-structured-output-across-three-ai-backends-4b98"
  },
  "original_language": "en",
  "account": "On March 3rd, 2026, a planning step in the content pipeline requested the model to return entities as JSON. The model complied, returning valid JSON. However, the code expected a specific structure, a JSON object with an \"entities\" field. The bare top-level array instead of an envelope object led to a schema failure, a layer that the parse failure alone could not catch. The two-layer fix involved including the exact JSON schema in the prompt and adding a fallback to automatically wrap the bare array if needed. This approach, known as schema-in-prompt, is a portable layer of defense against structured JSON output issues, especially when native enforcement is not available or identical across all AI backends.",
  "summary": "On March 3rd, 2026, a planning step in our content pipeline asked the model for a list of entities and got back exactly what it asked for. That was the problem. The prompt said: return the entities as JSON. The model returned JSON. Perfectly valid JSON. Any parser on earth would have accepted it. What it returned was this: [ \"prompt-caching\" , \"context-windows\" , ... ] What the code expected was…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}