I'm getting the following Json format string as a result from a Facebook graph search request :
{
"data": [
{
"name": "Event A",
"start_time": "2013-11-08T19:00:00+0200",
"end_time": "2013-11-10T00:00:00+0200",
"timezone": "Europe/Bucharest",
"id": "232252355126"
},
{
"name": "Event B",
"start_time": "2013-11-08T13:00:00+0200",
"end_time": "2013-11-09T16:00:00+0200",
"timezone": "Europe/Bucharest",
"location": "Bucharest",
"id": "414334343426"
},
{
"name": "Event C",
"start_time": "2013-10-30T18:30:00+0200",
"timezone": "Europe/Bucharest",
"location": "Bucharest",
"id": "44315995273"
}
],
"paging": {
"previous": "https://graph.facebook.com/search?limit=3&type=event&q=Bucharest&since=1383930000&__paging_token=22251255126",
"next": "https://graph.facebook.com/search?limit=3&type=event&q=Bucharest&until=1383150600&__paging_token=44115995273"
}
}
I'm encountering some errors while trying to retrieve data from this JSON. I've tried with
dynamic jsonData = await facebookClient.GetTaskAsync(string.Format("https://graph.facebook.com/search?q={0}&type=event&limit={1}&offset={2}", locationKeyword, limit, offset));
dynamic result = JsonConvert.DeserializeObject(jsonData.ToString());
Some answers direct me to use JavaScriptSerializer
but I don't have the namespace for that class, as I'm using API for developing Windows 8 Apps.
I can't manage how to get the events as somehow from data
object.
I tried accessing the values in the immediate windows in VS as result.data
but it's not working.
I search on how to make this but most answers seem to say to create a class in which the json data will fit.
Can't I achieve this with dynamic
? (something like result.data.name, result.paging.previous etc)