【发布时间】:2015-11-09 00:22:52
【问题描述】:
我正在尝试使用 fastxml 和下面的 JSON 构建一个 Java 对象
JSON : {"name":"Location Test",
"location":{
"coordinates":[10.1234657,10.123467]
},
...
}
我遇到了这个异常:
play.api.Application$$anon$1: Execution exception[[RuntimeException: com.fasterxml.jackson.databind.JsonMappingException:
Can not deserialize instance of double[] out of START_OBJECT token
at [Source: N/A; line: -1, column: -1] (through reference chain: com.mypackages.models.Place["location"])]]
地点类:
public class Place{
private String name;
private Location location;
...
getters and setters
}
位置类:
public class Location{
private double[] coordinates;
public Location(double[] coordinates) {
this.coordinates = coordinates;
}
...
//getter and setter for coordinate field
}
谁能告诉我是什么导致了这个问题?
【问题讨论】:
标签: java json jackson fasterxml