How to decode JSON object with Rust keyword attribute name?
You can use the serde
crate. It supports renaming of fields since February 2015
Your example could then look like this:
#[derive(Deserialize)]struct MyObj { #[serde(rename = "type")] type_name: String}