[DataContract(Name="UserInfo")] public class User { [DataMember(Name = "ID")] public string UserID{get;set;} [DataMember(Name="Name")] public string UserName { get; set; } [DataMember(Name="Pwd")] public string UserPwd { get; set; } [DataMember(Name="Sex")] public bool Sex { get; set; } [DataMember(Name="Age")] public int Age { get; set; } }
通过AJAX发送回数据
{
"CalssName":"UserInfo",
"ClassData":"{"ID":"530332","Name":"张三","Pwd":"123456","Sex":"0","Age":"20"}"
}
怎么样把它"反序列化"
来生成一个User实体对象