Created
December 24, 2014 05:43
-
-
Save pmsanford/f5b6c5bdb2eb3e6197d6 to your computer and use it in GitHub Desktop.
This file contains 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 serialize; | |
use serialize::json; | |
use std::os; | |
use std::io::fs::File; | |
fn main() { | |
let args: Vec<String> = os::args(); | |
let mut r = &mut File::open(&Path::new(args[1].as_slice())); | |
let json = json::from_reader(r); | |
if let Ok(json::Json::Object(map)) = json { | |
for key in map.keys() { | |
println!("{}", key); | |
} | |
} else { | |
println!("Not an object."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment