dataclasses-json
dataclasses-json copied to clipboard
Easily serialize Data Classes to and from JSON
Is there a way to configure a dataclass_json class to skip encoding some or any fields when they have None values?
``` File "\lib\site-packages\dataclasses_json\api.py", line 165, in schema Schema = build_schema(cls, DataClassJsonMixin, infer_missing, partial) File "\lib\site-packages\dataclasses_json\mm.py", line 349, in build_schema schema_ = schema(cls, mixin, infer_missing) File "\lib\site-packages\dataclasses_json\mm.py", line 301, in schema...
> this seems like a risky way to determine whether `NewType` as it relies on typing's internal implementation rather than public API, but unless there's a better alternative I'm ok...
using `NamedTuple` from the `typing` module don't seem to be supported. I also tried `collections.namedtuple` variant, but running into the same issue. **dataclasses-json version**: 0.5.5 example: ``` from collections import...
How should we use `typing.Tuple`? Here's an ipython session illustrating the problem: ``` In [1]: from dataclasses_json import DataClassJsonMixin In [2]: from dataclasses import dataclass In [3]: @dataclass ...: class...
Performance in general is on my radar as things to tackle next, as this library gains traction, and the top of a 1.0 release checklist. In general after some thought...
It looks like I can't override *init* method in a subclass and instantiate the subclass. Let's assume, my base class, **Data** is defined as follows: ``` @dataclass_json(undefined=Undefined.EXCLUDE) @dataclass class Data:...
Hi I would like to ask to add extended support for user-defined generics. This means that the class should define its custom decoder and encoder which then accepts its data,...
## Motivation With a field like so, the library attempted to incorrectly decode the type even if there was a None value. ``` control_data: Optional[Dict[str, Dict[str, Any]]] = None, ```...
New functionality to support serializing/deserializing none serializable functions and bound methods. The decorators take an alias name to build maps between the function/method and the alias and the other way...