Forums - C# Corner

Forum guidelines
Neethu pradeep

Neethu pradeep

  • 1.7k
  • 36
  • 1.5k

Parsing of nested JSON array

Nov 22 2018 12:40 AM
have a json array contains object which is details of countries and each country details include "language" array which is contains objects and  each contais 'name" and other language detais(List of Language). how to parse this nested json array using c#. 
Uri page = new Uri("");
HttpClient client = new HttpClient();
string response = await client.GetStringAsync(page);
JArray objectArray = (JArray)JsonConvert.DeserializeObject(response);
foreach (JObject jobject in objectArray)
   WorkItem.Add(new WorkItem()
      Country = (jobject["name"].ToString()),
      Capital = (jobject["capital"].ToString()),
      Imag = (jobject["flag"].ToString()),
      Region = (jobject["region"].ToString()),
      S_region = (jobject["subregion"].ToString()),
      Population = (int)(jobject["population"]),
      Area = (double?)(jobject["area"])
Now how can i add list of languages on this WorkItem collection of each object of WorkItem calss
(on visual studio 2015, for window phone 8.1) 

Answers (1)