Java教程

Postman传递Josn字段报错:Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out o

本文主要是介绍Postman传递Josn字段报错:Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out o,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Postman传递Josn字段报错:Cannot deserialize instance of java.util.ArrayList<java.lang.Object> out of VALUE_STRING token

  • 问题:
    image

    2021-08-02 10:15:07.816 ERROR 9796 --- [nio-8082-exec-6] c.y.c.b.e.GlobalExceptionHandler : /training/add : JSON parse error: Cannot deserialize instance of java.util.ArrayList<java.lang.Object> out of VALUE_STRING token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList<java.lang.Object> out of VALUE_STRING token
    at [Source: (PushbackInputStream); line: 9, column: 20] (through reference chain: com.yun.cloud.gap.entity.request.record.EmployeeTrainingRequest["trainingUrls"])

  • 原因:此时在数据映射过程中,数据类型不兼容以致于在相互转化时出错。因此我们只需要修改为数组格式“[“值1”,“值2”,…]”就行,如下图所示:

    image

这篇关于Postman传递Josn字段报错:Cannot deserialize instance of `java.util.ArrayList<java.lang.Object>` out o的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!