日期:2014-05-17  浏览次数:20988 次

求实体类:请问这样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.recordlistc