-
Notifications
You must be signed in to change notification settings - Fork 108
Support struct field renaming #106
Comments
https://github.com/serde-rs/serde already has something like this
or if you want different names for different serializations...
|
but serde is not a proper replacement for rustc-serialize, as it's missing some drammatic features like deserealising only part of json fields serde-rs/serde#60 |
@redlolgeerf I agree serde is not a proper replacement. I was showing that as an example of how it could be implemented. |
@fenhl , my point is that requested feature is a needed one, despite presence of libraries, that do have it. |
cc @fuchsnj (assuming @redlolgeerf's comment was supposed to be directed at them) |
I'm interested in this. |
@redlolgeerf: The soon to be released serde v0.7.0 will by default automatically ignore unknown fields, with an attribute that restores the old behavior. |
any movement on this? |
Has this been implemented yet? |
Now that Serde is a proper replacement for rustc-serialize (and more), I think the idea is you should use Serde if you need to customize the serialized representation in any way, including renaming fields. #[derive(Serialize, Deserialize)]
struct Thing {
#[serde(rename = "type")]
ty: String
} |
I'm going to close this now that this crate is deprecated in favor of serde. We're discontinuing feature development in rustc-serialize but will still continue to merge bug fixes if they arise. |
There needs to be a way to rename struct fields for use with
#[derive(RustcDecodable, RustcEncodable)]
.For example:
The text was updated successfully, but these errors were encountered: