Structured output: JSON output is sometimes concatenated with itself (+ \n)
OpenAI Developer Community
May 23, 2026
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:
{
"id": "chatcmpl-DigYwsHhd3XmY3QJKnk5XPf13JWi0",
"object": "chat.completion",
"created": 1779542414,
"model": "gpt-5.4-2026-03-05",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "<JSON TEXT>\n<SAME JSON TEXT>"
,
"refusal": null,
"annotations": []
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 30501,
"completion_tokens": 5718,
"total_tokens": 36219,
"prompt_tokens_details": {
"cached_tokens": 3840,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 1478,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"service_tier": "default",
"system_fingerprint": null
}
I hope OpenAI team can investigate the problem with the “id” field above.
We’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.
Discussion in the ATmosphere