typedload This module is the inverse of dataloader. It converts typed data structures to things that json can serialize.

Classes

Dumper

This dumps data structures recursively using only
basic types, lists and dictionaries.

A value dumped in this way from a typed data structure
can be loaded back using dataloader.

hidedefault: Enabled by default.
    When enabled, does not include fields that have the
    same value as the default in the dump.

isodates: Disabled by default.
    Will be enabled by default from version 3.
    When disabled, datetime.datetime, datetime.time, datetime.date
    are dumped as lists of ints.

    When enabled they are dumped as strings in ISO 8601 format.

    When enabled, timezone information will work.

raiseconditionerrors: Enabled by default.
    Raises exceptions when evaluating a condition from an
    handler. When disabled, the exceptions are not raised
    and the condition is considered False.

mangle_key: Defaults to 'name'
    Specifies which key is used into the metadata dictionaries
    to perform name-mangling.

handlers: This is the list that the dumper uses to
    perform its task.
    The type is:
    List[
        Tuple[
            Callable[[Any], bool],
            Callable[['Dumper', Any, Any], Any]
        ]
    ]
    The elements are: Tuple[Condition, Dumper]
    Condition(value) -> Bool
    Dumper(dumper, value, value_type) -> simpler_value

    In most cases, it is sufficient to append new elements
    at the end, to handle more types.

strconstructed: Set of types to dump to a string.

These parameters can be set as named arguments in the constructor
or they can be set later on.

The constructor will accept any named argument, but only the documented
ones have any effect. This is to allow custom handlers to have their
own parameters as well.

Because internal caches are used, after the first call to dump() these properties
should no longer be modified.

There is support for:
    * Basic python types (int, str, bool, float, NoneType)
    * NamedTuple, dataclasses, attrs, TypedDict
    * Dict[TypeA, TypeB]
    * Enum
    * List
    * Tuple
    * Set
    * FrozenSet
    * Path
    * IPv4Address, IPv6Address, IPv4Network, IPv6Network, IPv4Interface, IPv6Interface
    * datetime