Hi everyone,
Im trying to deserialize this style of xml list that are not technically a list but behaves like one:
<list>
<id-00001>
<name type="string">Pedro</name>
<age type="number">37</age>
</id-00001>
<id-00002>
<name type="string">Alex</name>
<age type="number">30</age>
</id-00002>
<list>
The number of items on the "list" is variable and will only increment the number(x) on the id-0000x
.
The issue is that i cant think how to map this to a Rust struct using serde.
Im trying to do something like this:
#[derive(Debug, Default, Deserialize)]
#[serde(rename = "list")]
List{
people: Vec<Person>
}
#[derive(Debug, Default, Deserialize)]
Person {
name: String,
age: u8
}
but i dont know how to deal with the this tags id-0000x
.
Edit:
this are the dependencies that im using:
[dependencies]
serde = { version = "1.0.117", features = ["derive"] }
serde-xml-rs = "0.4.0"
Thanks for the help in advance.
Regards