Postman传递Josn字段报错:Cannot deserialize instance of java.util.ArrayList<java.lang.Object>
out of VALUE_STRING token
-
问题:
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 ofjava.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”,…]”就行,如下图所示: