serdelicacy
This function is the entrypoint to serdelicacy's deserialization process:
serdelicacy.load
This function is the entrypoint to serdelicacy's serialization process:
serdelicacy.dump
You may use the following tools to:
- Operate on serdelicacy-affecred Python values in a typesafe way
- Augment dataclasses.dataclass to give serdelicacy more information about how to process data.
serdelicacy.get
serdelicacy.is_missing
serdelicacy.Override
The following types are custom to `serdelicacy`:
serdelicacy.OptionalProperty
Example
from typing import List, Optional
from dataclasses import dataclass
import serdelicacy
from serdelicacy import OptionalProperty
DATA = [
{
"hello": "friend",
"world": "foe",
},
{
"hello": "Rawr",
},
{
"hello": None,
"world": "hehe",
},
]
@dataclass
class HelloWorld:
hello: Optional[str]
world: OptionalProperty[str]
PARSED = serdelicacy.load(DATA, List[HelloWorld])
assert serdelicacy.is_missing(PARSED[1].world)
assert not PARSED[1].world # note: it's Falsey!
assert PARSED[2].hello is None
serdelicacy may raise the following Python exceptions during the serialization and/or the deserialization process.
serdelicacy.SerdeError
serdelicacy.DeserializeError
serdelicacy.SerializeError