diff --git a/__serialization/serde_json/src/main.rs b/__serialization/serde_json/src/main.rs index 27e3ced..d824fa6 100644 --- a/__serialization/serde_json/src/main.rs +++ b/__serialization/serde_json/src/main.rs @@ -40,6 +40,13 @@ struct TestStruct { timestamp: DateTime, } +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct TestStruct2 { + test_id: i32, + test_name: String, +} + fn main() -> Result<()> { let serialized = serde_json::to_string(&TestStruct{ ty: TestEnum::TypeA, @@ -76,5 +83,11 @@ fn main() -> Result<()> { } println!("{}", john); + let test_struct2 = TestStruct2 { + test_id: 1, + test_name: "Hatter".into(), + }; + println!("{}", serde_json::to_string(&test_struct2)?); + Ok(()) }