我当前正在使用Json-简单的jar文件,并且需要将json对象转换为json数组,我在很多地方都读到了使用
JSONParser parse = new JSONParser();
JSONObject jobj = (JSONObject) parse.parse(jsonString);
JSONArray arr = jsonObject.getJSONArray("users");
但是无法识别getJSONArray()方法。它说找不到符号。我已经导入了所有的org.json包,但不确定如何运行。
我的JSON来自网址,并且是:
{
"warnings":[
],
"users":[
{
"id":12345678,
"username":"abc123",
"firstname":"ABC",
"lastname":"DEF",
"fullname":"ABC",
"email":"abc@gmail.com",
"department":"Autoz",
"idnumber":"1234",
"firstaccess":2552,
"lastaccess":4242,
"auth":"ldap",
"suspended":false,
"confirmed":true,
"lang":"en",
"theme":"",
"timezone":"99",
"mailformat":1,
"description":"Software Engineer",
"descriptionformat":1,
"city":"Lahore",
"profileimageurlsmall":"srwegwegdrz",
"profileimageurl":"rbdrrebhez"
}
]
}