首页 > 解决方案 > Restsharp JSON 响应搜索

问题描述

我需要搜索以下 JSON 响应。我无法控制 JSON 如何返回给我或它是如何嵌套的。我默认使用 Restsharp,但我愿意接受任何可以帮助我完成任务的方法。

{
    "response": [
        {
            "id": 1008,
            "brandId": 74,
            "collectionId": 32,
            "productTypeId": 1,
            "nominalCodeStock": "1200",
            "nominalCodePurchases": "5002",
            "nominalCodeSales": "4000",
            "seasonIds": [
            ],
            "identity": {
                "sku": "SKU0001",
                "isbn": "0684843285",
                "ean": "ISNB09712345",
                "upc": "5778400001",
                "barcode": "738737638"
            },
            "productGroupId": 0,
            "featured": false,
            "stock": {
                "stockTracked": true,
                "weight": {
                    "magnitude": 0.7
                },
                "dimensions": {
                    "length": 2,
                    "height": 12,
                    "width": 5,
                    "volume": 120
                }
            },
            "financialDetails": {
                "taxCode": {
                    "id": 7,
                    "code": "T20"
                }
            },
            "salesChannels": [
                {
                    "salesChannelName": "Brightpearl",
                    "productName": "Product B",
                    "productCondition": "new",
                    "categories": [
                        {
                            "categoryCode": "276"
                        },
                        {
                            "categoryCode": "295"
                        }
                    ],
                    "description": {
                        "languageCode": "en",
                        "text": "Some description",
                        "format": "HTML_FRAGMENT"
                    },
                    "shortDescription": {
                        "languageCode": "en",
                        "text": "Some short description",
                        "format": "HTML_FRAGMENT"
                    }
                }
            ],
            "composition": {
                "bundle": false
            },
            "variations": [
                {
                    "optionId": 1,
                    "optionName": "Colour",
                    "optionValueId": 1,
                    "optionValue": "Black"
                },
                {
                    "optionId": 3,
                    "optionName": "Colour",
                    "optionValueId": 9,
                    "optionValue": "Black"
                }
            ],
            "warehouses": {
                "2": {
                    "defaultLocationId": 5,
                    "reorderLevel": 1,
                    "reorderQuantity": 0
                },
                "3": {
                    "defaultLocationId": 0,
                    "reorderLevel": 1,
                    "reorderQuantity": 1
                }
            },
            "createdOn": "2015-01-08T17:57:18.000Z",
            "updatedOn": "2015-04-01T13:17:58.000Z",
            "reporting": {
                "categoryId": 353,
                "subcategoryId": 369,
                "seasonId": 2
            },
            "primarySupplierId": 202,
            "status": "LIVE",
            "salesPopupMessage": "Offer the extended warranty",
            "version": 1192098806000
        }
    ]
}

具体来说,我需要检索 categoryCode 值。我迷路了。任何方向都非常感谢。

标签: c#jsonrestsharp

解决方案


推荐阅读