I would like to use serde_json
to parse a .json
file into a IndexMap
. However it says the Deserialize
trait has not been implemented for IndexMap
. Is there a way to use serde_json
with IndexMap
?
let elements: IndexMap<String, Value> = serde_json::from_str(r#"
{
"Hydrogen (H) ": 1,
"Helium (He)": 4,
"Lithium (Li)": 7,
"Beryllium (Be)": 9,
"Boron (B) ": 11,
"Carbon (C) ": 12,
"Nitrogen (N) ": 14,
"Oxygen (O) ": 16,
"Flourine (F) ": 19,
"Neon (Ne)": 20
}
"#).expect("err: unable to parse json");