输出SearchFacesResponse对象的JSON格式字符串回包乱码解决方案
- 输出SearchFacesResponse对象的JSON格式字符串
- 设置响应内容类型为
"application/json;charset=utf-8"
- 获取响应的字符输出流
- 将SearchFacesResponse对象转化为JSON字符串并输出。
代码片段
System.out.println(SearchFacesResponse.toJsonString(resp));
response.setContentType("application/json;charset=utf-8");
PrintWriter writer = response.getWriter();
writer.write(SearchFacesResponse.toJsonString(resp));