你好,我想解析这个 json:
[{
"codError": 0,
"msg": "OK"
}, {
"id": 1,
"role": {
"id": 4,
"name": "Super",
"description": "Roling.",
"rights": [],
"superuser": true,
"active": true,
"optimisticLock": 0
},
"now": null,
"points": [],
"firstName": null,
"lastName": null,
"loginName": "admin",
"password": null,
"connected": true,
"active": true,
"optimisticLock": null
},
["U4"]
]
我想要得到role id那是4, the 登录名那是admin和数组的值U4.
这是我尝试进行解析的方法:
// Role node is JSON Object
JSONObject role = getJSONObject(TAG_ROLE);
String role_id = role.getInt(TAG_ROLE_ID);
String loginName = getJSONObject(TAG_LOGINNAME);
我怎样才能获得U4值?非常感谢