What is the difference between DataMember and JsonProperty when using it in webapi2? Any performance differences? What is preferred to use?
Thanks! Andreas
In WebAPI, the default JSON formatter is Json.NET.
Json.NET is the one who reads the DataMember and JsonProperty attributes. JsonProperty is from Json.NET and its purpose is to control how the field or property is serialized. While DataMember, which is from Microsoft, is read by Json.NET for convenience.
JsonProperty provides more configuration options than DataMember.