I want to support nested traversal in a JSON object with deserialization, and possibly the same thing in serialization too, if time allows.
To better illustrate, consider a JSON object such as below:
{
"key": "value",
"contacts":
[
{"address": "1234 My Street",
"name": "John Smith"}
]
}It would be cool if we can map the first contacts[0].address to a dataclass field, like resident_address. I have below dataclass schema with an idea how that could work:
from dataclasses import dataclass
from dataclass_wizard import json_field, json_key
from typing_extensions import Annotated
@dataclass
class MyClass:
resident_address: str = json_field(path='contacts.0.address')
resident_name: Annotated[str, json_key(path=lambda x: x['contacts'][0]['name'])]List view
0 issues of 0 selected
There are no open issues in this milestone
Add issues to milestones to help organize your work for a particular release or project. Find and add issues with no milestones in this repo.