Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to parse with trailing commas #7

Open
benbuckman opened this issue Apr 10, 2024 · 0 comments
Open

Fails to parse with trailing commas #7

benbuckman opened this issue Apr 10, 2024 · 0 comments

Comments

@benbuckman
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant