rename_all is useful in situations where the format you're serializing from and the format you're serializing to may have different forms (i.e. rename_all(serialize = "SCREAMING_SNAKE_CASE", deserialize = "kebab-case"). It seems that when specifying tag for enums, the tag name is not affected by the rename_all attribute. This leads to inconsistencies in the serialized/deserialized data. There is also no way to specify a different tag value for Serialize and Deserialize.
rename_all
is useful in situations where the format you're serializing from and the format you're serializing to may have different forms (i.e.rename_all(serialize = "SCREAMING_SNAKE_CASE", deserialize = "kebab-case")
. It seems that when specifyingtag
for enums, the tag name is not affected by therename_all
attribute. This leads to inconsistencies in the serialized/deserialized data. There is also no way to specify a different tag value forSerialize
andDeserialize
.Example Output from
serde_json::to_string_pretty
:Example Code:
playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f5b7b498f6ae4abfbd85b905a6b28b34