-3

我正在使用 facebookClient 从 Facebook 获取用户的兴趣数据

我能够得到看起来像的数据

{"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":"创建网站" ,"类别":"社会/文化","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"}}

我如何将其转换为键值对。

4

1 回答 1

0
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?

于 2012-04-10T20:54:13.693 回答