在我的安卓应用中,我有一个类似于这样的JSON:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJtZWhkaS5hZ291emFsQGdtYWlsLmNvbSIsImV4cCI6MTQ2ODU1NTU4MjQ5MX0.A6-xNIZdbPv9mpjLO9jnnfbAeq1y-DC08SBUt2xBnYo",
"expires": 1468555582491,
"user": {
"imageURL": "http://app.com/images/null",
"email": "mail@gmail.com",
"firstname": "mister",
"lastname": "lalalala",
"password": "$2a$10$VDGtxjz9w7f170Wc66OJi.1T",
"id": "c19349c4044d34333",
"language": "EN",
"createdAt": "2015-07-07T14:15:54.000Z",
"updatedAt": "2016-05-06T08:25:20.000Z"
}
}
我可以这样访问“token”:
我可以这样访问“token”:
String json = new String(bytes);
JSONObject jsonObj = null;
try {
jsonObj = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
}
Log.d("debug", "TOKEN : " + jsonObj.getString("token"));
但我不知道如何获取用户的电子邮件或名字,例如。 我该如何做到这一点?
谢谢