I'm trying to figure out how to deserialize JSON into a structure using Serde. For instance, the example JSON on serde_json's own documentation contains the following data:
{
"FirstName": "John",
"LastName": "Doe",
"Age": 43,
"Address": {
"Street": "Downing Street 10",
"City": "London",
"Country": "Great Britain"
},
"PhoneNumbers": [
"+44 1234567",
"+44 2345678"
]
}
Now, if we assume that the above data is in a variable "input" and the following piece of code:
let deserialized_data: Data = serde_json::from_str(input).unwrap();
... what should struct Data
look like?