将一个List转成json对象返回到前台页面

List list = 向后台得到的list值存放(User);

     for(User u:list){
    System.out.println(u.toString());
     }

      JSONArray array = null;
   try {
       array = JSONArray.fromObject(list);//能过去
       } catch (Exception e) {
       e.printStackTrace();
   }    

猜你喜欢

转载自b-xinjun1120.iteye.com/blog/1767994