FaceBook Interests field with asp.net

I,m using facebookClient to get Interest data of user from face book

i,m able to get the data which looks like

{"data":[{"name":"Lean Startup","category":"Product/service","id":"387431575880","created_time":"2012-04-10T10:00:38+0000"},{"name":"Enterpreneur","category":"Interest","id":"376510765740","created_time":"2012-04-10T10:00:38+0000"},{"name":"Aquariums","category":"Interest","id":"111987498819971","created_time":"2012-04-10T10:00:37+0000"},{"name":"Creating websites","category":"Society/culture","id":"153238868040287","created_time":"2012-04-10T10:00:37+0000"}],"paging":{"next":"https://graph.facebook.com/me?fields=interests,email&access_token=AAAtnZB65tZB7tsBAMr3M4ZAaUHypodxgIR9kSop3g6SfbaaKZBBB5K8MLLdT0bzJhwh1PPtK7ZCFJWOZB5vVV36haGkpxV2CoAcUlIl13ZBWOwZDZD&limit=5000&offset=5000&__after_id=153238868040287"}}

how can i cast it to keyvalue pair.

Answers


dynamic result = fb.Get("me/interests");
var jsonArray= ((Facebook.JsonArray)result.data);
var nvDict = new Dictionary<string,string>();
foreach(dynamic obj in jsonArray)
{
    nvDict.Add(obj.id, obj.name);
}

Could you just keep the object as a Facebook.JsonObject rather than converting it into a Dictionary?


Need Your Help

Is there a way to send CakeResponse from blackhole callback

ajax cakephp

I am trying to make the ajax request more user friendly. It is a scenario that using a token which can be reuse in a period of time. However in time that a user has inactive for a certain time and ...

no lock and the usage of table name in from clause

sql-server

I have a question regarding the following query (an excerpt taken from complete query):