Skip to content

Fails to parse with trailing commas #7

@benbuckman

Description

@benbuckman

Hello.
I am experimenting with using this for parsing Visual Studio Code's settings.json files which are in Microsoft's flavor of JSONC.
That syntax supports trailing commas, JS-style, like:

{
     "hello": "world",
}

But when I try to parse this snippet with this library, it raises:

jsonc_parser.errors.ParserError: <path> file cannot be parsed (message: Expecting property name enclosed in double quotes

Perhaps this library is implementing a narrower spec than VS Code's (is there a spec for JSONC at all?), but I wonder if this lack of comma support makes it not so useful for practical purposes.

Also, a question (and maybe a bug), is parse_str,

def parse_str(_string: str) -> dict:

supposed to be an instance method (with self) or a @staticmethod (like parse_file)?

Thank you.

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