I have a dataclass, which looks like this:
@dataclass
class myClass:
id: str
mode: str
value: float
This results in:
dataclasses.asdict(myClass)
{"id": id, "mode": mode, "value": value}
But what I want is
{id:{"mode": mode, "value": value}}
I thought I could achive this by adding a to_dict
method to my dataclass, which returns the desired dict, but that didn't work.
How could I get my desired result?