json转为java的vo对象
String str = "[{'name':'hello',age:'21'},{'name':'hello2',age:'22'},{'name':'hello3',age:'23'}]"; JSONArray jsonArray = JSONArray.fromObject(str); List list = new ArrayList(); for ( int i = 0 ; i<jsonArray.size(); i++){ JSONObject jsonObject = jsonArray.getJSONObject(i); TestUserVo vo = (testUserVo) JSONObject.toBean(jsonObject,TestUserVo.class); System.out.println(vo.getAge()); list.add(vo); }
相关推荐
somebodyoneday 2020-06-15
adonislu 2020-06-02
baijinswpu 2020-02-19
adonislu 2020-02-14
83163452 2020-01-28
adonislu 2020-01-10
baijinswpu 2020-01-01
adonislu 2019-12-31
baijinswpu 2019-12-28
xufankang 2019-12-19
somebodyoneday 2019-12-07
abcx 2015-05-25
somebodyoneday 2019-10-30
newthon 2019-10-21
ZCMUCZX 2016-04-14
iovaaron 2015-04-10
Dolphinsz 2016-04-25