Skip to content

Json grammar doesn't allow array #102

@Saibo-creator

Description

@Saibo-creator

https://github.com/epfl-dlab/transformers-CFG/blob/main/examples/grammars/json.ebnf#L6

I just realise that the grammar here for json only allows json object at root level.

In fact, json grammar accepts array and other atomic values like string or number at root level.

So a string itself is a valid json.

Here is the spec of JSON standard: https://www.json.org/json-en.html

Probably we just need to replace the root grammar rule json::=object to json::= value and fix the potentially impacted tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions