Skip to content

Serde rename field attribute only for Serialize or Deserialize #1320

@deankarn

Description

@deankarn

Hi, first off Serde is amazing!

I came across a situation where I needed to rename a field for Deserialization and so came across the rename file attribute; the only issue is that I do not want to rename the Serialize, but use the rust name.

The situation I am using this in is accepting input from a legacy API and so want to remap the old names, however when serializing the same data to be stored/used in a new piece of code I didn't see a way to rename just Serialize or Deserialize and not both;

Is this possible? or could an option be added like rename_serialize & rename_deserialize?

it's possible I have missed this functionlity in the docs, thanks for any help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions