-
-
Notifications
You must be signed in to change notification settings - Fork 857
Open
Description
The rename_all
attribute is very handy for cases where you have fields named in ways that don't follow Rust conventions. However, there are cases where you might want to support both ways - for example, loading data with support for both naming conventions, but preferring a different naming convention for saving that data later. I propose that an alias_all
container attribute be added that functions similarly to rename_all
, so that a struct like this...
#[derive(Serialize, Deserialize)]
#[serde(alias_all = "PascalCase")]
pub struct MyStruct {
string: String,
bool: bool
}
...can be deserialized from JSON like this...
{"String":"hello world","Bool":true}
...but will still be serialized like this:
{"string":"hello world","bool":true}
avocadomaster, bruceg, dcb, james-jra, adwhit and 42 more
Metadata
Metadata
Assignees
Labels
No labels