如何为 json 响应对象创建 class 结构

How to create class structure for json response object

我有一个 json 响应对象,但我无法为以下 json 响应对象创建一个 class 结构。

{
    "PWSESSIONRS": [
        {
            "PWPROCESSRS": {
                "PWHEADER": {
                    "APP_ID": "HSA",
                    "ORG_ID": "HSA",
                    "OUT_PROCESS_ID": "weconnect_validate",
                    "IN_PROCESS_ID": "weconnect_validate",
                    "LOGIN_ID": "TEST10800"
                },
                "PWDATA": {
                    "weconnect_validate": {
                        "Row": [
                            {
                                "success": "1"
                            }
                        ]
                    }
                }
            }
        }
    ]
}

请给我建议一些 class 结构。我创建了以下 class 结构,但 Json.Convert 无法反序列化它。

public class LoginSuccess
    {
        public List<PwProcessorSuccess> PWSESSIONRS { get; set; }
    }
    public class RowSuccess
    {
        public string success { get; set; }
    }
    public class WeconnectValidateSuccess
    {
        public List<RowSuccess> Row { get; set; }
    }
    public class PwDataSuccess
    {
        public WeconnectValidateSuccess weconnect_validate { get; set; }
    }
    public class PwHeaderSucess
    {
        public string LOGIN_ID { get; set; }
        public string ORG_ID { get; set; }
        public string APP_ID { get; set; }
        public string IN_PROCESS_ID { get; set; }
        public string OUT_PROCESS_ID { get; set; }
    }
    public class PwProcessorSuccess
    {
        public PwHeaderSucess PWHEADER { get; set; }
        public PwDataSuccess PWDATA { get; set; }
    }

请帮忙。

我从一开始就为你做了类,这样下面的代码对你有很大帮助,你的问题会立即得到解决。
您可以使用以下代码:

public class MainKeepClass
{ 
    public PWSESSIONR[] PWSESSIONRS { get; set; }
}

public class PWSESSIONR
{
    public PWPROCESSRS PWPROCESSRS { get; set; }
}

public class PWPROCESSRS
{
    public PWHEADER PWHEADER { get; set; }
    public PWDATA PWDATA { get; set; }
}

public class PWHEADER
{
    public string APP_ID { get; set; }
    public string ORG_ID { get; set; }
    public string OUT_PROCESS_ID { get; set; }
    public string IN_PROCESS_ID { get; set; }
    public string LOGIN_ID { get; set; }
}

public class PWDATA
{
    public Weconnect_Validate weconnect_validate { get; set; }
}

public class Weconnect_Validate
{
    public Row[] Row { get; set; }
}

public class Row
{
    public string success { get; set; }
}