You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a JSON file format in which there can be dynamic generated keys at the root position. the name of each key is unique and is not know at dissect time. The value of each key is standardized. I would like to deserialize the JSON so I can both deserialize the value and also keep the key.
here is a very basic example
{
item1: {
value: 5
},
item99: {
value: 1
},
}
The text was updated successfully, but these errors were encountered:
ZNackasha
changed the title
how to dissect on a unknow key name?
How to dissect on a unknow key name?
Sep 12, 2018
ZNackasha
changed the title
How to dissect on a unknow key name?
How to dissect on a unknow key?
Sep 12, 2018
This is the first result on google, so I just wanted to point out that if you do not know the types of the values, then you can just specify serde_json::Value as the hashmap value type:
let key_values:HashMap<String, serde_json::Value> = serde_json::from_str(&text)?;
I have a JSON file format in which there can be dynamic generated keys at the root position. the name of each key is unique and is not know at dissect time. The value of each key is standardized. I would like to deserialize the JSON so I can both deserialize the value and also keep the key.
here is a very basic example
The text was updated successfully, but these errors were encountered: