I am new to JSON and Web API. I have gone through helping books to make a simple console app that gets a URL response i.e. JSON and parse it using NewtonSoft. I cannot access the VoiceIAQStats portion data from the JSON. I need assistance in parsing:
My code is:
async static void GetRequest(string url)
{
using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = await client.GetAsync(url))// .GetAsync(url))
{
using (HttpContent content = response.Content)
{
string mycontent = await content.ReadAsStringAsync();
//Console.WriteLine(mycontent);
JArray a = JArray.Parse(mycontent);
Console.WriteLine("Total Count is " + a.Count());
Console.WriteLine("Data is " + a.ToString());
}
}
}
}
The JSON Result is as follows:
[{"id":"faisal","operation":"UPDATE","VoiceIAQStats":{"id":9,"esdId":9,"esdName":"faisal"}}]