Add more precise examples
fusion2222 opened this issue · comments
fusion2222 commented
I am trying to deserialize a json string which can have various format. For this basically, we need to deserialize string containing json, into Value
object. I followed docs, however looks like it is not possible to work with Value
object, like docs say it will - (In this case docs are referring to serde_json
) docs.
I would love to use miniserde
, however I am very not sure how to use this library and docs are not helpful much. My non-working snippet:
use miniserde::{json, Serialize, Deserialize};
fn main() {
let my_json_data = r#"
{
"name": "John Doe",
"age": 43,
"phones": [
"+44 1234567",
"+44 2345678"
]
}"#;
let deserialized : json::Value = json::from_str(my_json_data).unwrap();
println!("[+] Early quitting! {:#?}", deserialized["name"]);
The line at the bottom throws following error:
error[E0608]: cannot index into a value of type `miniserde::json::Value`
mbartlett21 commented