lundi 1 décembre 2014

Jackson deserializing GMaps JSON


Vote count:

0




I am trying to deserialize the following JSON: http://ift.tt/12hl4rF


My doubt is, how to I deserialize it in a way I only get results.geometry.location.lat and results.geometry.location.lng ?


Since I am using Spring, I tried using RestTemplate and annotate the helper class as follow, without success:



public class GmapsDto {

t@JsonProperty("results/geometry/location/lat")
private String lat;

@JsonProperty("results.geometry.location.lng")
private String lng;

public String getLat() {
return lat;
}

public void setLat(String lat) {
this.lat = lat;
}

public String getLng() {
return lng;
}

public void setLng(String lng) {
this.lng = lng;
}
}


Is there a way to navigate through the object tree and get only the info I need?


Thanks.



asked 45 secs ago







Jackson deserializing GMaps JSON

Aucun commentaire:

Enregistrer un commentaire