#Failed to deserialize json data into struct since `type` is a keyword
4 messages · Page 1 of 1 (latest)
or (worse) r#type for the field's name
As Helix (noop_noob) suggested I would suggest using serde rename to rename the field automatically during deserialization because otherwise the word type is a reserved keyword in rust and you cannot use it. So according to the suggestion here is the updated version of your code 🙂 :
#[derive(serde::Deserialize)]
struct ChildrenEntry {
date_added: String,
date_last_used: String,
guid: String,
id: String,
meta_info: BookmarkIgnore3,
name: String,
#[serde(rename = "type")]
some_type: String,
url: String,
}
I hope this helps 🙂