美文网首页
list集合转换为json

list集合转换为json

作者: Alex_1799 | 来源:发表于2018-05-04 15:10 被阅读0次

//后台
Gson gson=new Gson();
String json=gson.toJson(集合, new TypeToken<List<集合装的类型>>(){}.getType());

//写入数据到前台
resp.setCharacterEncoding("UTF-8");
PrintWriter pw=resp.getWriter();
pw.write(json);

相关文章

网友评论

      本文标题:list集合转换为json

      本文链接:https://www.haomeiwen.com/subject/ibvdrftx.html