How to remove k__BackingField from Json data
当用DataContractJsonSerializer类序列化对象为Json时,发现序列化后的json对象,每个属性都带有k__BackingField后缀,像这样:
解决办法:为要被序列化的类打上相应标记,像下面这样:
[Serializable] [DataContract] public class Person { private string _name; [DataMember] public string Name { get { return _name; } set { _name = value; } } }
参考:http://forums.asp.net/t/1903020.aspx/1