【组件使用问题】--使用FastJson序列化报错Could not write JSON: write javaBean error, fastjson version 1.2.62

调试过程中捕获的报错信息:

Could not write JSON: write javaBean error, fastjson version 1.2.62, class 
org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultip
artFile, fieldName : 0, write javaBean error, fastjson version 1.2.62, class 
org.springframework.web.multipart.MultipartFileResource, fieldName : resource

出现该问题的原因是因为属性中有不能被序列化的字段,比如Multipart类型的字段就不能被序列化。可以通过在不需要序列化的属性上添加@JSONFailed(serialize=false)排除该属性。

@JSONField(serialize = false)
private List<MultipartFile> houseFiles;
发布了58 篇原创文章 · 获赞 18 · 访问量 8402

猜你喜欢

转载自blog.csdn.net/qq_43199016/article/details/104080481
今日推荐