Json字符串里面包含数组对象转Java数组对象

String   requestBody = 

"[
{"userName":"Tom","userAccount":"123","userSex":1,"schoolId":999,"gradeId":"1003","classId":"1006","artType":1},
{"userName":"marry","userAccount":"123","userSex":1, "schoolId":999,"gradeId":"1003","classId":"1006","artType":1}
]"

List userList = JSONArray.parseArray(requestBody, AuthUserBean.class);

JSONArray导的jar包是 import com.alibaba.fastjson.JSONArray;

调用JSONArray.parseArray(字符串, 对象的class) 就可以将Json数组对象字符串转换成Java数组对象

你可能感兴趣的:(类型转换)