在@RequestMapping
属性添加属性produces = "text/html;charset=utf-8"
,设置字符集为utf-8即可
代码如下:
@RequestMapping(value = "/json",produces = "text/html;charset=utf-8")
@ResponseBody
public String getJsonList(){
List<Book> books = bookService.getBookList();
return JSON.toJSONString(books);
}