JSON与MySQL
我在MySql表字段中遇到错误 我尝试用SpringBoot将Postman的JSON数据发送到MySql 在这个JSON的结构中,有一个值数组 问题是,当我得到这些值时在包含数组的MYSQL字段中。它写信给我:JSON与MySQL,mysql,spring-boot,Mysql,Spring Boot,我在MySql表字段中遇到错误 我尝试用SpringBoot将Postman的JSON数据发送到MySql 在这个JSON的结构中,有一个值数组 问题是,当我得到这些值时在包含数组的MYSQL字段中。它写信给我: ¬í ur [Ljava.lang.String; ÒVçé {G xp t.arrayValue1, arrayValue2 在Spring Boot控制台上,我得到一个警告: 2020-09-18 12: 05: 14.854 WARN 18384 --- [nio-8181
¬í ur [Ljava.lang.String; ÒVçé {G xp t.arrayValue1, arrayValue2
在Spring Boot控制台上,我得到一个警告:
2020-09-18 12: 05: 14.854 WARN 18384 --- [nio-8181-exec-5] .wsmsDefaultHandlerExceptionResolver: Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `[ Ljava.lang.String; `out of VALUE_STRING token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `[Ljava.lang.String;` out of VALUE_STRING token
at [Source: (PushbackInputStream); line: 22, column: 16] (through reference chain: com.glv.entities.Devis ["accessory"])]
JSON格式:
{
"accessory": ["arrayValue1", "arrayValue2"]
}
弹簧启动代码:
private string[] accessory;
public void setAccessory(String[] accessory) {
this.accessory = accessory;
我把“附件”翻译成“附件”,这样就可以理解了