2013-03-31 38 views
0

當我從Facebook圖執行獲取時,我收到了一個comlex字符串。如何安排Facebook圖形API響應

有沒有將其分解爲「圖形用戶」的方法?

例如:

{"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); 

謝謝。

我需要在這個教程中轉換成JSON

和處理它

+0

這不是一個「複雜」字符串,它是JSON。 http://www.androidhive.info/2012/01/android-json-parsing-tutorial/ – dmon

+0

謝謝你的男人, –

回答