dataclasses-json icon indicating copy to clipboard operation
dataclasses-json copied to clipboard

recursively ignoring fields that are not json serializable?

Open li-dennis opened this issue 4 years ago • 1 comments

Hi,

I'm using a few libraries that aren't readily JSON Serializable, and rather than attempt to write a serializer for every time it shows up, I rather just ignore it. Is there a simple way to do this? I can't seem to find anything in the documents that addresses this.

Best

li-dennis avatar Nov 03 '20 11:11 li-dennis

Hi there.

Could you do something like this?

@dataclass
class EncodeExclude(DataClassJsonMixin):
    some_field: str
    ignored_field: str = field(metadata=config(exclude=Exclude.ALWAYS))

matt035343 avatar Jun 10 '23 19:06 matt035343