原文:https://blog.csdn.net/qq_26289533/article/details/78749057
方式 1. : 自写代码转 Json
需要 HttpHttpServletRequest request HttpServletResponse response
后台 :
@RequestMapping(value="/haha") public string xxx { HttpHttpServletRequest request,HttpServletResponse response} { JSONObject json =new JSONObject(); json.put("result"," success") response.setCharacterEncoding("utf-8"); response.setContentType("application/json;charset=utf-8"); PrintWriter out = null; out = response.getWriter(); out.write(json.toString()); }