Springboot使用FastJson中文乱码解决方法。
来源:互联网 发布:javascript reduce 编辑:程序博客网 时间:2024/06/06 01:59
使用FastJson之前中文是没有乱码的,一旦使用了FastJson,接口返回数据用postman测试没乱码,但是直接传回到浏览器页面就会乱码。
解决办法:
@Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { super.configureMessageConverters(converters); FastJsonHttpMessageConverter fastConverter=new FastJsonHttpMessageConverter(); FastJsonConfig fastconfig=fastConverter.getFastJsonConfig(); fastconfig.setSerializerFeatures( SerializerFeature.PrettyFormat );// 乱码解决代码 List<MediaType> fastMediaTypes = new ArrayList<>(); fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8); fastConverter.setSupportedMediaTypes(fastMediaTypes); fastConverter.setFastJsonConfig(fastconfig); converters.add(fastConverter); }
结果:
阅读全文
0 0
- Springboot使用FastJson中文乱码解决方法。
- SpringBoot+FastJson 中文乱码问题
- Springboot使用FastJson后,接口返回中文乱码的问题解决。
- 解决Springboot使用FastJson 返回中文乱码的问题
- Springboot使用FastJson后,接口返回中文乱码的问题解决(两种解决方式)
- springboot使用fastjson
- SpringBoot中使用fastjson
- springboot使用fastjson
- SpringBoot 使用fastjson初识
- SpringBoot 用fastjson替换到jackjson并解决中文乱码的问题
- Spring MVC使用fastjson数据传到前台中文乱码解决
- springmvc 使用fastjson 处理 json 数据时中文乱码
- fastjson在springboot中的使用
- SpringBoot配置FastJson并解决乱码问题
- springboot配置fastjson并解决乱码问题
- springboot系列文章(四)-springboot使用fastjson
- spring MVC-fastjson中文乱码
- springboot乱码解决方法
- 【Spring+SpringMVC+MyBatis深入学习及搭建】02.MyBatis原始Dao开发和mapper代理开发
- camera1 实时预览取帧
- 不重叠随机圆的JAVASCRIPT程序实现
- Linux redis集群环境准备
- QMediaPlayer播放视频
- Springboot使用FastJson中文乱码解决方法。
- CentOS系统redis主从模式实现
- oracle备份还原
- 中兴跳楼程序员妻子:他们就这样把我老公逼死了
- Linux安装python 2.7.9
- Sybase IQ并发DML的两个小技巧commit和lock table
- 开心Google之旅
- 集合
- dorado7数据库准备工作出现的错误