Null key for a Map not allowed in JSON

本文探讨了在使用Spring框架时遇到的一个问题:尝试将含有空键的地图对象序列化为JSON时引发的HttpMessageNotWritableException错误。文章详细描述了错误信息及作者遇到的具体场景,并寻求解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


今天遇到一个奇葩问题,百思不得其解,望各位大佬给予解答:



这样运行的时候报错,

警告: Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?); nested exception is com.fasterxml.jackson.core.JsonGenerationException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)



这样的话,返回数据正常!baseResultMap对应的是上面的VoSysEnum.

求大佬们帮忙...

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值