#[derive(Debug, Serialize, Deserialize)]
struct Foo {
// for DynamoDB, name is reserved, so use "foo_name" as the field name
#[serde(rename = "foo_name")]
name: String,
}
When I write to DynamoDB, I need to rename the name field. When I serialize as a JSON string, I'd like to not have it named foo_name.
While I could use an intermediate struct, is there another way to conditionalize the rename, so that the JSON string has {"name": "some-name"}?