如何安排Facebook Graph API响应

时间:2013-03-31 14:45:48

标签: android facebook facebook-graph-api response

当我从Facebook图表执行get时,我得到了一个comlex字符串。

是否有将其分解为“图形用户”的方法?

例如:

{"data":[{"id":"112221111"},{"id":"112221111"},{"id":"112221111"},{"score":{"data":[{"score":77777,"user":{"id":"5551","name":"כr"},"application":{"id":"3463464363636336","namespace":"tomatosmasher","name":"Tomato Smasher"}]},"id":"667677577575","installed":true},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},{"id":"55555555"},

我正在使用的代码

                String currentUserFBID = user.getId();
                String currentUserAccessToken = Session.getActiveSession().getAccessToken();

// Execute the HTTP Get to our server for the scores of the user's friends
                HttpClient client = new DefaultHttpClient();
                String getURL = "https://graph.facebook.com/" + currentUserFBID + "/friends?access_token=" + currentUserAccessToken + "&fields=installed,score";
                HttpGet get = new HttpGet(getURL);
                HttpResponse responseGet = client.execute(get);

// Parse the response
                HttpEntity responseEntity = responseGet.getEntity();
                String response = EntityUtils.toString(responseEntity);

谢谢。

1 个答案:

答案 0 :(得分:0)

是的,dmon是正确的

我需要转换为JSON

通过本教程处理它。

http://www.androidhive.info/2012/01/android-json-parsing-tutorial/