Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token错误解决

「爱情、让人受尽委屈。」 2023-10-13 22:52 165阅读 0赞

Postman调试时报错:Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token。

原因:需要的是集合,但是传入的参数外面包装了一个对象。

  1. public Map<String, Object> addAddress(@RequestBody List<AcctAddress> records) {
  2. ​​​​​​​}

解决方式:把对象用数组的格式进行传递。

  1. [
  2. {
  3. "id": "606863377499837444",
  4. "createdBy": "601157755265372302",
  5. "created": "2023-06-02 14:59:14",
  6. "lastUpdated": "2023-06-02 14:59:14",
  7. "lastUpdatedBy": "601157755265372302",
  8. }
  9. ]

发表评论

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

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

相关阅读