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

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

我这里是做delete操作,需要传入id的值
json:
{
“id”: 1
}

然后向后台传,报错:
Could not read JSON: Can not deserialize instance of java.lang.Integer out …

我这里是做delete操作,需要传入id的值
json:

然后向后台传,报错:
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

# json

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×