0

我在解析一个非常困难的 json 字符串时遇到了很大的问题。例如

{
    "facilityDetails": [
        {
            "tableName": "FACILITY",
            "facilityDetails": [
                {
                    "id": 1,
                    "itemId": "s101",
                    "name": "facility",
                    "status": 1,
                    "lastEditedOn": "01/Jan/201200: 00: 00.000"
                }
            ]
        },
        {
            "tableName": "PLACE_SERVICE",
            "facilityDetails": [
                {
                    "id": 1,
                    "itemId": "22",
                    "name": "placeservice",
                    "facility": "5",
                    "status": 1,
                    "lastEditedOn": "01/Jan/201000: 00: 00.000"
                },
                {
                    "id": 2,
                    "itemId": "55",
                    "name": "placeservice",
                    "facility": "t",
                    "status": 2,
                    "lastEditedOn": "01/Jan/201000: 00: 00.000"
                },
                {
                    "id": 3,
                    "itemId": "99",
                    "name": "placeservice",
                    "facility": "r",
                    "status": 33,
                    "lastEditedOn": "01/Jan/201000: 00: 00.000"
                },
                {
                    "id": 4,
                    "itemId": "22",
                    "name": "placeservice",
                    "facility": "",
                    "status": 0,
                    "lastEditedOn": "01/Jan/201000: 00: 00.000"
                }
            ]
        },
        {
            "tableName": "AGENT",
            "facilityDetails": [
                {
                    "agentId": 2,
                    "itemId": "1",
                    "name": "agent",
                    "defUnitId": 0,
                    "defRouteId": 0,
                    "color": "",
                    "synonyms": "",
                    "administrationType": 0,
                    "status": 0,
                    "lastEditedOn": "01/Jan/201200: 00: 00.000"
                }
            ]
        }
    ]
}

对于这个 json 字符串,“facilityDetails”是一个内部数组,每次都有不同的细节。我如何解析这种类型的 json。如果有人知道请帮助我

4

1 回答 1

0

您应该能够使用 Json.NET 库来解析它。

http://james.newtonking.com/projects/json-net.aspx

于 2012-05-21T05:00:30.453 回答