json字符串转换为bean对象

String json = "{name:'hello',age:'12'}";

Muser user = (Muser) JSONObject.toBean(json, Muser.class);

 

jsonArray字符串转换为 List实例对象

String response = "[{name:'hello',age:'12'},{name:'hello',age:'12'}]";

JSONArray userArray = JSONArray.fromObject(response);

List<Muser> userList = (List<Muser>) JSONArray.toCollection(userArray, Muser.class);

或者

String response = "[{name:'hello',age:'12'},{name:'hello',age:'12'}]";

JSONArray datas = JSONArray.fromObject(response);
List<MProceedsAccount> lists = JSONArray.toList(datas, MProceedsAccount.class);

相关文章:

  • 2022-12-23
  • 2021-09-28
猜你喜欢
  • 2021-10-09
  • 2022-02-05
  • 2022-12-23
  • 2021-07-06
  • 2021-11-05
  • 2021-08-29
  • 2022-01-06
相关资源
相似解决方案