public void writerJson(List<Object> list) {
String json = JSONArray.toJSONString(list);
HttpServletResponse response = getResponse();
response.setContentType("application/json;charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
out.write(json);
} catch (IOException e) {
logger.error("BaseAction::writerJson catch exception:",e);
} finally {
if (out != null)
out.close();
}
}
【JAVA-工具类】list转json
最新推荐文章于 2024-04-18 05:39:52 发布