写入以下代码即可实现:
public static void main(String[] args) {
User_DAL userDal = new User_DAL();// 创建数据访问对象
ResponseResult
ret = userDal.getUserList("id String json = JSON.toJSONString(ret, true); // 将对象转换成json字符串,true为格式化输出
System.out.println(json);
List
list = JSON.parseArray("{{name:123},{name:456}}", User.class);//将json字符串,转换成Java对象数组 for (int i = 0; i
System.out.println(list.get(i).getName());
}
}