求实体类:请问这样JSON格式怎么创建实体类以便将JSON转实体类!
- JScript code
{"code":"0","message":{"recordtotalcount":3,"recordlistcount":3,"recordlistdetail":[{"customername":"??????","customerno":"79231842","certificateno":"1","sex":"","birthday":"","telephone":"1213","address":"????????????????????????????????????????????????"},{"customername":"??????","customerno":"79231842","certificateno":"610203198403100015","sex":"","birthday":"","telephone":"123456","address":"????????????????????????????????????????????????"},{"customername":"?????????","customerno":"79438322","certificateno":"61010419760409341X","sex":"","birthday":"","telephone":"13891921327","address":"?????????????????????6-1-2304"}]}}
[解决办法]
练手:
- C# code
//------------------------------------------// <auto-generated>// 此代码由工具生成。// 运行时版本:4.0.30319.269//// 对此文件的更改可能会导致不正确的行为,并且如果// 重新生成代码,这些更改将会丢失。// </auto-generated>//------------------------------------------using System.Xml.Serialization;// // 此源代码由 xsd 自动生成, Version=4.0.30319.1。// /// <remarks/>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)][System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]public partial class root { private string codeField; private rootMessage[] messageField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string code { get { return this.codeField; } set { this.codeField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("message", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public rootMessage[] message { get { return this.messageField; } set { this.messageField = value; } }}/// <remarks/>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]public partial class rootMessage { private string recordtotalcountField; private string recordlistcountField; private rootMessageRecordlistdetailItem[][] recordlistdetailField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string recordtotalcount { get { return this.recordtotalcountField; } set { this.recordtotalcountField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string recordlistcount { get { return this.recordlistcountField; } set { this.recordlistcountField = value; } } /// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] [System.Xml.Serialization.XmlArrayItemAttribute("item", typeof(rootMessageRecordlistdetailItem), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)] public rootMessageRecordlistdetailItem[][] recordlistdetail { get { return this.recordlistdetailField; } set { this.recordlistdetailField = value; } }}/// <remarks/>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]public partial class rootMessageRecordlistdetailItem { private string customernameField; private string customernoField; private string certificatenoField; private string sexField; private string birthdayField; private string telephoneField; private string addressField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string customername { get { return this.customernameField; } set { this.customernameField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string customerno { get { return this.customernoField; } set { this.customernoField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string certificateno { get { return this.certificatenoField; } set { this.certificatenoField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string sex { get { return this.sexField; } set { this.sexField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string birthday { get { return this.birthdayField; } set { this.birthdayField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string telephone { get { return this.telephoneField; } set { this.telephoneField = value; } } /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string address { get { return this.addressField; } set { this.addressField = value; } }}/// <remarks/>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)][System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]public partial class NewDataSet { private root[] itemsField; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("root")] public root[] Items { get { return this.itemsField; } set { this.itemsField = value; } }}