Last active
January 19, 2017 10:29
-
-
Save kybishop/ecf48136e0a189ebd8dbac4b93303d33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate serde_json; | |
fn main() { | |
decode_json(); | |
} | |
fn decode_json() -> Result<(), ()> { | |
// This works: let json: serde_json::Value = serde_json::from_str("[{}]").map_err(|error| { | |
// The below does not | |
let json = serde_json::from_str("[{}]").map_err(|error| { | |
println!("Error while decoding JSON: {:?}", error); | |
})?; | |
println!("JSON from string: {:?}", json); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment