Skip to main content

Known issues

This page records known behavior that may affect integrations. Each issue includes examples and a mitigation you can apply while handling model output.

JSON output may include a Markdown code fence

Diffusion generation can occasionally wrap an otherwise valid JSON object in a Markdown json code fence. In some responses, the three opening backticks are missing but the json label and closing backticks remain.

Examples

With the opening fence:

```json
{"name":"Priya","intent":"trial"}
```

With the opening backticks missing:

json
{"name":"Priya","intent":"trial"}
```

Mitigation

Before parsing a response that should be JSON, remove the wrapper only when the entire output has one of the two prefixes above and a closing fence on its own final line. Then parse and validate the result against your expected schema. Do not use a generic character trim: that can alter legitimate JSON or string values.

content=$(jq -r '.choices[0].message.content' response.json)

cleaned=$(
printf '%s' "$content" |
perl -0pe 's/\A(?:```json|json)[ \t]*\r?\n(.*)\r?\n```[ \t]*(?:\r?\n)?\z/$1/s'
)

printf '%s\n' "$cleaned" | jq .

If parsing or schema validation still fails, follow the bounded retry and fallback guidance in Prompt engineering.