0

We have an ASP.Net WebAPI (v5.2.2) application and use and a DTO object with a couple of fields for a method. We want to change the field name but alot of old clients still use the old DTO filed name.

What I am looking for is recommendations about the best way to "rewrite" property X to Y when deserializing if encountered but when serializing Y it should work as usual.

Somthing like a DataMember-ButAlsoDeserializeFrom("X")-Attribute kind of thing. Any ideas?

jmw
  • 2,864
  • 5
  • 27
  • 32
  • 1
    See [Making a property deserialize but not serialize with json.net](http://stackoverflow.com/q/11564091/10263) for some ideas. – Brian Rogers Feb 16 '16 at 15:59
  • I solved it by adding this code. [DataMember] internal string OldPropName { set { this.NewPropName = value; } } – jmw Mar 04 '16 at 07:04

0 Answers0