Skip to content

[FEATURE] Support JSON5 or generic parser #556

@coopstools

Description

@coopstools

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions