springmvc uses requestBody to parse json exceptions

{"principal":"Test","location":{"address":" Baisha Tuozheng Street, Jiguanshi Town, Nan'an District, Chongqing ","province":"Chongqing City","city":[],"region ":"Nan'an District","street":"","name":"Nan'an District","pointX":106.616724,"pointY":29.608757,"locate":" Baisha Tuozheng, Jiguanshi Town, Nan'an District, Chongqing Street "},"name":"Test"}

@RequestBody Restaurant restaurant

Error:

Exception: 
JSON parse error: Can not deserialize instance of java.lang.String out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@66dfbe5a; line: 1, column: 123] (through reference chain: com.kuding.user.bean.Restaurant["location"]->com.kuding.user.bean.Location["city"])
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not deserialize instance of java.lang.String out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@66dfbe5a; line: 1, column: 123] (through reference chain: com.kuding.user.bean.Restaurant["location"]->com.kuding.user.bean.Location["city"])
at com.kuding.web.WebContextFilter.doFilter(WebContextFilter.java:47)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
 at [Source: java.io.PushbackInputStream@66dfbe5a; line: 1, column: 123] (through reference chain: com.kuding.user.bean.Restaurant["location"]->com.kuding.user.bean.Location["city"])

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325569466&siteId=291194637