当从json文件中读取json数据返回前端时,Content-Type不同会导致返回给前端的数据结构也不同。
Content-Type: text/plain;charset=UTF-8
text/plain的意思是将文件设置为纯文本的形式,浏览器在获取到这种文件时并不会对其进行处理。
Content-Type: application/json;charset=UTF-8
@RequestMapping(value = "/ueditor",produces="text/plain;charset=UTF-8")
@ResponseBody
public String ueditor(String callback, HttpServletRequest request) throws IOException {}
当使用 produces=“text/plain;charset=UTF-8” 时解决了返回json(json字符串是从一个json文件中读取的)时,带转义符的情况
如果只是返回个对象,转成json,就不会存在这种带转义符的情况。