Skip to content

Instantly share code, notes, and snippets.

@pmsanford
Created December 24, 2014 05:43
Show Gist options
  • Save pmsanford/f5b6c5bdb2eb3e6197d6 to your computer and use it in GitHub Desktop.
Save pmsanford/f5b6c5bdb2eb3e6197d6 to your computer and use it in GitHub Desktop.
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