JSON output file has improved format
This commit is contained in:
+1
-1
@@ -101,7 +101,7 @@ pub mod parser {
|
|||||||
pub fn save_file(&self, vals: Vec<SomeObject>) -> std::io::Result<()> {
|
pub fn save_file(&self, vals: Vec<SomeObject>) -> std::io::Result<()> {
|
||||||
let filename: String = String::from("numbers.json");
|
let filename: String = String::from("numbers.json");
|
||||||
|
|
||||||
let json = serde_json::to_string(&vals).unwrap();
|
let json = serde_json::to_string_pretty(&vals).unwrap();
|
||||||
let mut file = File::create(filename)?;
|
let mut file = File::create(filename)?;
|
||||||
file.write_all(json.as_bytes())?;
|
file.write_all(json.as_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user