{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreidgn7mqny4xd2qcp7sa67q2vg5ud4bnit2rdi5iexnvdu7lflpxxm",
    "uri": "at://did:plc:lk3jfj3zq4k4wxnk474axylu/app.bsky.feed.post/3mmjtz4uijax2"
  },
  "path": "/t/structured-output-json-output-is-sometimes-concatenated-with-itself-n/1381642#post_1",
  "publishedAt": "2026-05-23T14:51:14.000Z",
  "site": "https://community.openai.com",
  "textContent": "I’m experiencing a problem with structured output, in the ChatCompletion API. Concretely, the ‘content’ field, which is supposed to contain a JSON string, contains the same JSON string twice, separated by a newline character. Concretely, I get:\n\n\n    {\n      \"id\": \"chatcmpl-DigYwsHhd3XmY3QJKnk5XPf13JWi0\",\n      \"object\": \"chat.completion\",\n      \"created\": 1779542414,\n      \"model\": \"gpt-5.4-2026-03-05\",\n      \"choices\": [\n        {\n          \"index\": 0,\n          \"message\": {\n            \"role\": \"assistant\",\n            \"content\": \"<JSON TEXT>\\n<SAME JSON TEXT>\"\n    ,\n            \"refusal\": null,\n            \"annotations\": []\n          },\n          \"finish_reason\": \"stop\"\n        }\n      ],\n      \"usage\": {\n        \"prompt_tokens\": 30501,\n        \"completion_tokens\": 5718,\n        \"total_tokens\": 36219,\n        \"prompt_tokens_details\": {\n          \"cached_tokens\": 3840,\n          \"audio_tokens\": 0\n        },\n        \"completion_tokens_details\": {\n          \"reasoning_tokens\": 1478,\n          \"audio_tokens\": 0,\n          \"accepted_prediction_tokens\": 0,\n          \"rejected_prediction_tokens\": 0\n        }\n      },\n      \"service_tier\": \"default\",\n      \"system_fingerprint\": null\n    }\n\n\nI hope OpenAI team can investigate the problem with the “id” field above.\n\nWe’ve added client-side logic to workaround this bug, but I thought it would be worth reporting. Observed only with GPT-5* models, not 4o, for instance.",
  "title": "Structured output: JSON output is sometimes concatenated with itself (+ \\n)"
}