I have rest url that gives me all countries - http://api.geonames.org/countryInfoJSON?username=volodiaL.
I use RestTemplate from spring 3 to parse returned json into
You need to do the following:
public class CountryInfoResponse {
@JsonProperty("geonames")
private List countries;
//getter - setter
}
RestTemplate restTemplate = new RestTemplate();
List countries = restTemplate.getForObject("http://api.geonames.org/countryInfoJSON?username=volodiaL",CountryInfoResponse.class).getCountries();
It would be great if you could use some kind of annotation to allow you to skip levels, but it's not yet possible (see this and this)