JSONObject resp = new JSONObject(respStr);
JSONArray data = resp.getJSONArray("data");
LOG.debug("Found contacts : " + data.length());
for (int i = 0; i < data.length(); i++) {
JSONObject obj = data.getJSONObject(i);
Contact p = new Contact();
String name = obj.getString("name");
if (name != null) {
String nameArr[] = name.split(" ");
if (nameArr.length > 1) {
p.setFirstName(nameArr[0]);
p.setLastName(nameArr[1]);
} else {
p.setFirstName(obj.getString("name"));
}
p.setDisplayName(name);
}
p.setId(obj.getString("id"));
p.setProfileUrl(PUBLIC_PROFILE_URL + obj.getString("id"));
p.setProfileImageURL(String.format(PROFILE_IMAGE_URL,
obj.getString("id")));
plist.add(p);
}
} catch (Exception e) {
throw new ServerDataException(