{Response: responseCode: 200, graphObject: {"id":"98374978103","birthday":"04\/19\/1991","gender":"male","email":"email@gmail.com","name":"Wasfasf"}, error: null}
I am getting facebook response as above string
How to parse this string.
I am doing it this way
try {
String res = response.toString();
JSONObject obj = new JSONObject(res);
JSONArray arr = obj.optJSONArray("graphObject");
for(int i=0; i < arr.length(); i++) {
JSONObject jsonObject = arr.getJSONObject(i);
String id = jsonObject.optString("id").toString();
String bday = jsonObject.optString("birthday").toString();
String gender = jsonObject.optString("gender").toString();
String email = jsonObject.optString("email").toString();
String name = jsonObject.optString("name").toString();
}
} catch (Exception e) {
e.printStackTrace();
}
It throws the exception :
Unterminated object at character 25 of {Response: responseCode: 200, graphObject: {"id":"983797084978103","birthday":"04\/19\/1991","gender":"male","email":"waleedbinilyas@gmail.com","name":"Waleed Bin Ilyas"}, error: null}