I am not able to extract value from a JSON where strings don't have double quotes around then in json_serde. Json_serde::Value is failing in json_serde::from_str()
use serde_json::{Result, Value};
fn main() -> Result<()>{
let raw_text = r##"{
"url" : https://www.google.com
}"##;
println!("{}",raw_text);
let v: Value = serde_json::from_str(raw_text)?;
//let detail: Value = serde_json:: from_str(&v["detail"].to_string())?;
println!("{}", v["url"]);
Ok(())
}
Output
json git:master ❯❯❯ cargo run ✭
Compiling json v0.1.0 (/home/d/Documents/RustScripts/json)
Finished dev [unoptimized + debuginfo] target(s) in 0.21s
Running `target/debug/json`
{
"url" : https://www.google.com
}
Error: Error("expected value", line: 2, column: 19)