Open mnieber opened 5 months ago
I'm always frustrated when a solution could use a function, but instead relies on creating or modifying classes.
Allow a functional approach to parsing a json, e.g.
@dataclass class Person: name: str person = parse( data=person_json, cls=Person, encoders=dict( name=encode_name ), validators=dict( name=validate_name ) )
An additional benefit is that I can flexibly choose the encoders and validators (they are not baked into my Person data-structure)
person = parse( data=person_json_in_format_a, cls=Person, encoders=format_a_encoders, validators=format_a_validators )
I've looked into various solutions based on Pydantic. I haven't found any nice ones (dataclasses-json looks like it might be the nicest one so far).
No response
Duplicate of https://github.com/lidatong/dataclasses-json/issues/442
Description
I'm always frustrated when a solution could use a function, but instead relies on creating or modifying classes.
Possible solution
Allow a functional approach to parsing a json, e.g.
An additional benefit is that I can flexibly choose the encoders and validators (they are not baked into my Person data-structure)
Alternatives
I've looked into various solutions based on Pydantic. I haven't found any nice ones (dataclasses-json looks like it might be the nicest one so far).
Context
No response