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

UseOAuthBearerTokens vs UseOAuthBearerAuthentication

asp.net-identity asp.net-web-api2 owin asp.net-identity-2 katana

In our Startup class, I have configured the following auth server options:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.