Fixed JSON export.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-07-02 14:31:14 +02:00
parent 774e5fc987
commit 0a9debfd3f

View File

@ -26,6 +26,7 @@ extern crate rand;
use structopt::StructOpt; use structopt::StructOpt;
use serde::{Serialize,Deserialize}; use serde::{Serialize,Deserialize};
use serde_json::json;
// define the commandline parameters // define the commandline parameters
#[derive(StructOpt)] #[derive(StructOpt)]
@ -130,7 +131,9 @@ fn main()
else else
{ {
// export data to JSON format // export data to JSON format
let out_json = serde_json::to_string(&prisoners).unwrap(); let out_json = json!({
"prisoners": prisoners
});
println!("{}", out_json); println!("{}", out_json);
} }
} }