How do I access a JSONObject subfield?

前端 未结 4 2091
自闭症患者
自闭症患者 2021-02-13 23:03

I feel dumb but I\'ve been looking around for this for a while. I\'m working with the google geocoder API and I need a bit of help with the json responses. Here is a JSONObje

4条回答
  •  终归单人心
    2021-02-13 23:36

    You should create Class Location to pull the "location" subfields.

    public class Location {
        private double lat;
        private double lng;
    
    @JsonCreator
        public Location(@JsonProperty("lat") double lat, @JsonProperty("lng") double lng {
            this.lat = lat;
            this.lngenter code here = lng;
        }
    

提交回复
热议问题