Android 杰克逊';s在Gson中的JsonNode实现
由于dex的大小,我目前正在将Jackson实现转换为Gson 我想知道Gson的等价物是什么Android 杰克逊';s在Gson中的JsonNode实现,android,serialization,jackson,gson,Android,Serialization,Jackson,Gson,由于dex的大小,我目前正在将Jackson实现转换为Gson 我想知道Gson的等价物是什么 public void setNortheast(JsonNode northeast) { LatLng northBound = new LatLng(northeast.get("lat").asDouble(), northeast.get("lng").asDouble()); this.northeast = northBound; } 我
public void setNortheast(JsonNode northeast) {
LatLng northBound = new LatLng(northeast.get("lat").asDouble(), northeast.get("lng").asDouble());
this.northeast = northBound;
}
我写过:
public void setNortheast(JsonObject northeast) {
LatLng northBound = null;
try {
northBound = new LatLng(Double.parseDouble(northeast.getString("lat")), Double.parseDouble(northeast.getString("lng")));
} catch(JsonException e) {
}
this.northeast = northBound;
}
但是,它似乎不起作用。我是否编写了正确的代码
提前谢谢!:我认为应该使用getDouble而不是Double.parseDouble(“字符串”) 东北方向。getDouble(“lat”) 东北双(“液化天然气”) 修改代码如下:
public void setNortheast(JsonObject northeast) {
LatLng northBound = null;
try {
northBound = new LatLng(northeast.getDouble("lat"), northeast.getDouble("lng"));
} catch(JsonException e) {
}
this.northeast = northBound;
}
参考资料:你得到了什么?您是否确认参数
JsonObject
设置正确?