我正在尝试使用 Jackson 2 解组以下 JSON 文件:
{
"mapID": "123",
"objects": [
{
"mapID": "123",
"objectID": "12",
"properties": {
"type": "2",
"maxSpeed": "110",
"name": "name1",
"bridge": false
},
"geometry": {
"coordinates": [
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
}
]
}
},
{
"mapID": "123",
"objectID": "14",
"properties": {
"type": "5",
"name": "name2",
"redLightTime": "40"
},
"geometry": {
"coordinates": [
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
}
]
}
},
{
"mapID" : "123",
"objectID" : "13",
"properties" : {
"type" : "4",
"maxSpeed" : "40",
"name" : "name3",
"roundaboutLanes" : "2"
},
"geometry": {
"coordinates" : [
[
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
},
{
"latitude" : 4.54559326171875,
"longitude" : 45.754109791149865
}
]
]
}
}
]
}
public class MapJSON {
private int mapID;
private List<Objects> objects;
public int getMapID() {
return mapID;
}
public void setMapID(int mapID) {
this.mapID = mapID;
}
public List<Objects> getObjects() {
return objects;
}
public void setObjects(List<Objects> objects) {
this.objects = objects;
}
}
public class Objects {
private int mapID;
private int objectID;
private Properties properties;
private Geometry geometry;
public int getMapID() {
return mapID;
}
public void setMapID(int mapID) {
this.mapID = mapID;
}
public int getObjectID() {
return objectID;
}
public void setObjectID(int objectID) {
this.objectID = objectID;
}
public Properties getProperties() {
return properties;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
public Geometry getGeometry() {
return geometry;
}
public void setGeometry(Geometry geometry) {
this.geometry = geometry;
}
}
public class Geometry {
private List<Coordinates> coordinates;
public List<Coordinates> getCoordinates() {
return coordinates;
}
public void setCoordinates(List<Coordinates> coordinates) {
this.coordinates = coordinates;
}
}
public class Coordinates {
private Double latitude;
private Double longitude;
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
解组几何/坐标元素时发生错误。有人可以指出错误在哪里吗?
在几何部分之前一切正常。