And I’m trying to deserialize it, but I can’t seem to get it right. Isn’t this accurate?
#[derive(Deserialize, Debug)]
#[serde(untagged)]
enum NationResponse {
Nation(Nation),
People(Vec),
}
struct Person {
id : i32,
age : i32,
name : String
}
struct Nation {
id : i32,
country : String
}
Edit:
The problem I was actually experiencing was trying to use an enum as the response. Yes the formatting for my example was wrong (it should have been an array). But the structure besides that was accurate.