Given some JSON:
{
"name": "Dude",
"foo": {
"bar": "baz"
}
}
Assuming I want to map it to a struct like this:
struct Chump {
Name: string,
Bar: string,
}
which means I'd like to map Chump.Bar to foo.bar, is there any way I can easily achieve this with serde? Or any other form of JSON (de)serializer?
The only way I found so far is to use
#[serde(flatten)]
to get a Map of whatever gets left after parsing. Is there a better, more efficient way, maybe?