起因
json数组,一时间竟然不知道该怎么去解析它了
List转Json
List<Student> students = new ArrayList();
String str = JSON.toJSONString(students);
Json转List
方法一:
String json = ""; //获取的Json数据
List<Student> students = JSON.parseObject(json,new TypeReference<List<Student>>(){});
方法二:
List<Student> students = JSON.parseArray(json,Student.class);