User969992919 posted
Hi,
I am using below code to get list of halls using JSON.NET.
I want to know how can I loop through the result to get hall_name?
Here is my code followed by sample result.
var client = new HttpClient();
client.BaseAddress = new Uri("https://www.domain.com/ws/populate_halls_in_location.php");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync("https://www.domain.com/ws/populate_halls_in_location.php");
if (response.IsSuccessStatusCode)
{
var data = await response.Content.ReadAsStringAsync();
dynamic storydata = JsonConvert.DeserializeObject(data);
*************************
*************************
*************************
LOOP THROUGH THE RESULT FROM storedata to get hall_name
*************************
*************************
*************************
};
here is ample output:
[
{
"hall_id":1,
"0":1,
"site_id":7,
"1":7,
"hall_name":"Hall No. 1",
"is_active":1,
"3":1
},
{
"hall_id":2,
"0":2,
"site_id":7,
"1":7,
"hall_name":"Hall No. 2",
"is_active":1,
"3":1
},
{
"hall_id":3,
"0":3,
"site_id":7,
"1":7,
"hall_name":"Hall No. 3",
"is_active":1,
"3":1
}
]