C# Json转换为数组字符串

C# Json转换为数组字符串,c#,json,C#,Json,我使用winform在json中得到了这个响应,我想将它转换为一个数组。从您的json中获取站点Generet类。并将JSON反序列化为生成的类。有时工具生成的类并不理想,所以要小心 { "response_code": "AVAILABLE", "remittance": { "transaction_id": "c2e7de4a-7646-4ff4-986c-e5a0c87c48d8", "status": "NEW", "so

我使用winform在json中得到了这个响应,我想将它转换为一个数组。

从您的json中获取站点Generet类。并将JSON反序列化为生成的类。有时工具生成的类并不理想,所以要小心

{
    "response_code": "AVAILABLE",
    "remittance": {
        "transaction_id": "c2e7de4a-7646-4ff4-986c-e5a0c87c48d8",
        "status": "NEW",
        "source_reference_number": "RN-0006",
        "remitter": {
            "name": "Juan Dela Cruz",
            "first_name": null,
            "middle_name": null,
            "last_name": null,
            "contact_number": null,
            "account_number": null,
            "address": {
                "address_1": "Manila",
                "country": "PH"
            },
            "identification": {
                "name": "SSS",
                "number": "2313",
                "type": "SSS_ID",
                "expiry_date": "2018-01-01",
                "place_of_issue": "Manila"
            }
        },
        "beneficiary": {
            "name": "Jane Dela Cruz",
            "first_name": null,
            "middle_name": null,
            "last_name": null,
            "contact_number": null,
            "account_number": null,
            "address": {
                "address_1": "Manila",
                "country": "PH"
            },
            "identification": {
                "name": "",
                "number": "",
                "type": "",
                "expiry_date": null,
                "place_of_issue": ""
            }
        },
        "payout_amount": {
            "currency": "PHP",
            "amount": "5000.00"
        },
        "remarks": null,
        "value_date": "2016-03-21",
        "date_created": "2016-03-21 07:24:44 UTC"
    },
    "response_message": "Transaction Available For Payout."
}
并将对象反序列化为类:

public class Address
{
    public string address_1 { get; set; }
    public string country { get; set; }
}

public class Identification
{
    public string name { get; set; }
    public string number { get; set; }
    public string type { get; set; }
    public string expiry_date { get; set; }
    public string place_of_issue { get; set; }
}

public class Remitter
{
    public string name { get; set; }
    public object first_name { get; set; }
    public object middle_name { get; set; }
    public object last_name { get; set; }
    public object contact_number { get; set; }
    public object account_number { get; set; }
    public Address address { get; set; }
    public Identification identification { get; set; }
}

public class Beneficiary
{
    public string name { get; set; }
    public object first_name { get; set; }
    public object middle_name { get; set; }
    public object last_name { get; set; }
    public object contact_number { get; set; }
    public object account_number { get; set; }
    public Address address { get; set; }
    public Identification identification { get; set; }
}

public class PayoutAmount
{
    public string currency { get; set; }
    public string amount { get; set; }
}

public class Remittance
{
    public string transaction_id { get; set; }
    public string status { get; set; }
    public string source_reference_number { get; set; }
    public Remitter remitter { get; set; }
    public Beneficiary beneficiary { get; set; }
    public PayoutAmount payout_amount { get; set; }
    public object remarks { get; set; }
    public string value_date { get; set; }
    public string date_created { get; set; }
}

public class RootObject
{
    public string response_code { get; set; }
    public Remittance remittance { get; set; }
    public string response_message { get; set; }
}

什么阻止了你?关于Json有很多问题。您是否查看了其中是否有帮助?为什么要将其存储为数组?当然它需要用地图来表示…我想把它们分开。。。我正在阅读关于Jsonconvert.Deserializeobject的文章,但我还不知道
string json = "...Your json..."
RootObject ro = JsonConvert.DeserializeObject<RootObject>(json);