mirror of https://github.com/dnomd343/ClearDNS
Dnomd343
2 years ago
3 changed files with 55 additions and 1 deletions
@ -1,3 +1,22 @@ |
|||||
|
use serde_json::{Value}; |
||||
|
|
||||
|
fn json_str() -> String { |
||||
|
let json = r#"{ |
||||
|
"demo": "key_1", |
||||
|
"author": "dnomd343", |
||||
|
"test": [ |
||||
|
"123", |
||||
|
"234", |
||||
|
"345" |
||||
|
] |
||||
|
}"#; |
||||
|
return String::from(json); |
||||
|
} |
||||
|
|
||||
fn main() { |
fn main() { |
||||
println!("Hello, world!"); |
let raw = json_str(); |
||||
|
println!("JSON raw content ->\n{}", raw); |
||||
|
|
||||
|
let parsed: Value = serde_json::from_str(&raw[..]).unwrap(); |
||||
|
println!("Author -> {}", parsed["author"]); |
||||
} |
} |
||||
|
Loading…
Reference in new issue