Need array of string of ExternalRateId in return

Viewed 29

Here is my JSON string. Can I get the string[] of ExternalRateId for all RateCards?

As of now, I'm using foreach() to loop through Ratecards and then through Rates to get the list of ExternalRateId and converting it to a string[]. Can we solve this in much easier way using SelectToken(). If so please show me the best way to do this.

{
    "RateCards": [
        {
            "ExternalRateCardId": "62283ab4",
            "Rates": [
                {
                    "ExternalRateId": "2a77db10",
                }
            ],
            "IsUpdate": false
        },
        {
            "ExternalRateCardId": "f6878b23",
            "Rates": [
                {
                    "ExternalRateId": "2a739550",
                }
            ],
            "IsUpdate": false
        },
        {
            "ExternalRateCardId": "3f51162c",
            "Rates": [
                {
                    "ExternalRateId": "2a751bf0",
                }
            ],
            "IsUpdate": false
        }
    ]
}

Was using foreach to get the list. Then converting them to string[]. Is there an easy way to fetch all ExternalRateId for all RateCards

0 Answers
Related