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

[FEATURE] Support JSON5 or generic parser #556

Open
coopstools opened this issue Mar 13, 2025 · 0 comments
Open

[FEATURE] Support JSON5 or generic parser #556

coopstools opened this issue Mar 13, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@coopstools
Copy link

Description

JSON5 is gaining wider use as it has a few nice features. It would be nice to be able to use this library with JSON5 strings.

Possible solution

Two proposals:

  • change the from_json to use a generic json parser (or even just generic parser if we wanna have some fun). This could be a global variable, a function passed in on the annotation, or a function passed in at the time of calling from_json
  • Add a new method called from_json5.

The first is nice as we can keep bloat out of the code base, and let the end user manually set things. The latter is nice as it minimizes effort for the end user.

In my fork, I took the second approach, while also adding a from_json5f to allow passing in a file/IO object.

Alternatives

Right not, the solution is to load the object into a dict using json5.load, and then pass the dictionary into the from_dict method.

Context

No response

@coopstools coopstools added the enhancement New feature or request label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant