Could not read JSON: Can not deserialize instance of java.lang.Integer out of START_OBJECT token

男娘i 2022-05-15 06:40 836阅读 0赞

我这里是做delete操作,需要传入id的值
json:
{ "id": 1 }
然后向后台传,报错:
Could not read JSON: Can not deserialize instance of java.lang.Integer out of START_OBJECT token
原因在于:
Spring 会将{id:id}这个json转换成Map对象,只要将@requestBody中的参数改成Map就可以了

参考:
https://blog.csdn.net/tangyajun_168/article/details/7929410

发表评论

表情:
评论列表 (有 0 条评论,836人围观)

还没有评论,来说两句吧...

相关阅读