[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
chrono = { version = "0.4", features = ["serde"] }
use serde::{Serialize, Deserialize};
// A simple student struct
#[derive(Serialize, Deserialize)]
pub struct Student {
#[serde(rename = "firstName")]
first_name: Option<String>,
#[serde(rename = "lastName")]
last_name: Option<String>,
#[serde(rename = "age")]
age: Option<u64>,
}
extern crate serde;
extern crate serde_json;
extern crate chrono;
use std::fs;
use student::Student;
mod student;
fn main() {
let input = fs::read_to_string("input.json").expect("Could not read input");
let student: Student = serde_json::from_str(&input).unwrap();
let output = serde_json::to_string(&student).unwrap();
fs::write("output.json", output).expect("Could not write output");
}