MaxCoder88
MaxCoder88

Reputation: 2428

How do I parse below Json in ASP.Net?

I'm using Json.Net.My question is:How do I parse below Json in ASP.Net?Thanks in advance.

  [
  {
  "1":[
     "Fax1",
     "Fax2",
     "Fax3"
  ]
  },
  {
  "2":[
     "SES1",
     "SES2",
     "SES3"
  ]
  },
  {
  "3":[
     "IVR1",
     "IVR2",
     "IVR3"
   ]
  }
  ]

Upvotes: 0

Views: 71

Answers (1)

Torbjörn Hansson
Torbjörn Hansson

Reputation: 19423

You may deserialize this as an array of Dictionary:

Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string,string[]>[]>(jsonData);

or alternative as List instead of arrays:

Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string,List<string>>>>(jsonData);

Upvotes: 1

Related Questions