我使用facebookClient从脸书中获取用户的兴趣数据
我能够获得看起来像
的数据{“data”:[{“name”:“Lean Startup”,“category”:“Product / service”,“id”:“387431575880”,“created_time”:“2012-04-10T10:00: 38 + 0000 “},{” 名称 “:” 企业家”, “类别”: “利息”, “ID”: “376510765740”, “CREATED_TIME”: “2012-04-10T10:00:38 + 0000”}, { “名称”: “水族馆”, “类别”: “利息”, “ID”: “111987498819971”, “CREATED_TIME”: “2012-04-10T10:00:37 + 0000”},{ “名称”:”创建网站“,”类别“:”社会/文化“,”id“:”153238868040287“,”created_time“:”2012-04-10T10:00:37 + 0000“}],”分页“:{”下一个“ : “https://graph.facebook.com/me?fields=interests,email&access_token=AAAtnZB65tZB7tsBAMr3M4ZAaUHypodxgIR9kSop3g6SfbaaKZBBB5K8MLLdT0bzJhwh1PPtK7ZCFJWOZB5vVV36haGkpxV2CoAcUlIl13ZBWOwZDZD&limit=5000&offset=5000&__after_id=153238868040287”}}
如何将其转换为keyvalue对。
答案 0 :(得分: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);
}
你能将对象保留为Facebook.JsonObject而不是将其转换为字典吗?