Skip to content

broken JSON made by Claude Sonnet 4.5 that does not parse #2

@khera

Description

@khera

I'm running into some odd issues with the output in JSON format from Claude Sonnet 4.5 suddenly the last few days. Here are two examples that fail to parse even with jaison.

I redacted the actual text of the JSON but retained the structure. The errors produced are identical with the full content of what Claude made.

{
    "value1": true,
    "value2": "short_string",
    "content": [
    "## MARKDOWN TEXT\nsome text.\",
    "## MARKDOWN TEXT\nsome text."
    ],
    "value3": false
}

The error from jaison is

Unexpected identifier "##" in value position. Only recognized constants (true, false, null, undefined, etc.) are allowed.

{
    "value1": true,
    "value2": "short_string",
    "content": [
    "## MARKDOWN TEXT\nsome text.\",
    "value3": false
}

The error is

Unexpected identifier "value3" in value position. Only recognized constants (true, false, null, undefined, etc.) are allowed.

I'm not sure if it is possible to detect these. The second one is really broken badly but the first one I would hope could be fixed.

Given your proposed use case is to fix the stuff generated by LLMs that are not quite right, I submit these two in case you have any ideas how to deal with them. Thanks for sharing your project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions