springmvc使用requestBody解析json异常

{"principal":"测试","location":{"address":"重庆市南岸区鸡冠石镇白沙沱正街","province":"重庆市","city":[],"region":"南岸区","street":"","name":"南岸区","pointX":106.616724,"pointY":29.608757,"locate":"重庆市南岸区鸡冠石镇白沙沱正街"},"name":"测试"}

@RequestBody Restaurant restaurant

报错:

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"])

猜你喜欢

转载自blog.csdn.net/asdfsadfasdfsa/article/details/80105267