Skip to content

[for yq] Decode Stream Tokenisation allows missing "," in JSON #548

@mikefarah

Description

@mikefarah

yq is using the goccy/json Decoder tokeniser, and a bug has been raised whereby invalid JSON documents that are missing a comma between map key-value pairs are parsed:

{
  "hello": "value"
  "foo": "bar"
}

Issue is (unless I'm missing something) the tokeniser does not emit a token for the comma, so in the yq code when creating my ast; I cannot determine if it's missing or not.

Looking at the goccy tokeniser code, I can see that the "," is skipped over in tokenisation:

See

case ',', ':':

Not sure what the best path forward is...perhaps the streaming code should validate that there is a "," when expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions