python-dataclasses-serialization icon indicating copy to clipboard operation
python-dataclasses-serialization copied to clipboard

Serialize/deserialize Python dataclasses to various other data formats

Results 8 python-dataclasses-serialization issues
Sort by recently updated
recently updated
newest added

As of python3.7 dataclasses is built in to python dataclasses package even changed their supported versions after 0.6 to `>=3.6,

``` ____________________ TestJSON.test_json_serialization_types ____________________ self = Serializer(serialization_functions=RefinementDict(lookup={: , ), is_subset=, is_element=)) cls = typing.Dict, serialized_obj = {'name': 'Fred'} @curry def deserialize(self, cls, serialized_obj): """ Attempt to deserialize serialized object as...

dataclasses_serialization.__version__== '1.3.1' Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:30:23) [MSC v.1928 32 bit (Intel)] on win32 Windows 10 Pro Version 2004, Build 19041.867 Here's what I've narrowed it down to:...

This code ``` try: return cls(**{ fld.name: deserialization_func(fld_type, dct[fld.name]) for fld, fld_type in zip(flds, fld_types) if fld.name in dct }) except TypeError: raise DeserializationError("Missing one or more required fields to...

You can add a generic serializer which works for all Enums like so ``` @JSONSerializer.register_serializer(Enum) def Enum_serializer(obj: Enum) -> str: return obj.name @JSONSerializer.register_deserializer(Enum) def Enum_deserializer(cls, name: str) -> Enum: try:...

I receive JSON with a datetime field called `from`. As `from` is a keyword in Python, I cannot create a dataclass with a `from` field. So deserialization is not possible....

It would be convenient to be able to do that for PyMongo and Flask jsonify.

Adds Tuple-handling to the `JSONSerializer`, using a `tuple_deserialization` function that will also make it easier for custom serialisers to handle tuples. Also adds documentation and type-annotations to the `Serializer` class...