Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 436 Bytes

flatten.md

File metadata and controls

22 lines (17 loc) · 436 Bytes

Flatten

You can flatten the fields of the nested structure.

@serde
@dataclass
class Bar:
    c: float
    d: bool

@serde
@dataclass
class Foo:
    a: int
    b: str
    bar: Bar = field(metadata={'serde_flatten': True})

Bar's c, d fields will be deserialized as if they are defined in Foo.

For complete example, please see examples/flatten.py