B4J Question How to parsing Json

jinyistudio

Well-Known Member
Licensed User
Hi

Following json code is from google map.
I don't know how to get value.
Please teach me(or sample code) how to get lat and lng value of "location" with JSONParser. :(

B4X:
{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "30",
               "short_name" : "30",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "錦上街",
               "short_name" : "錦上街",
               "types" : [ "route" ]
            },
            {
               "long_name" : "頂店里",
               "short_name" : "頂店里",
               "types" : [ "administrative_area_level_4", "political" ]
            },
            {
               "long_name" : "大甲區",
               "short_name" : "大甲區",
               "types" : [ "administrative_area_level_3", "political" ]
            },
            {
               "long_name" : "台中市",
               "short_name" : "台中市",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "台灣",
               "short_name" : "TW",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "437",
               "short_name" : "437",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "437台灣台中市大甲區錦上街30號",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 24.3537189,
                  "lng" : 120.6297067
               },
               "southwest" : {
                  "lat" : 24.3537066,
                  "lng" : 120.6296936
               }
            },
            "location" : {
               "lat" : 24.3537066,
               "lng" : 120.6296936
            },
            "location_type" : "RANGE_INTERPOLATED",
            "viewport" : {
               "northeast" : {
                  "lat" : 24.3550617302915,
                  "lng" : 120.6310491302915
               },
               "southwest" : {
                  "lat" : 24.3523637697085,
                  "lng" : 120.6283511697085
               }
            }
         },
         "partial_match" : true,
         "place_id" : "Eik0Mzflj7DngaPlj7DkuK3luILlpKfnlLLljYDpjKbkuIrooZczMOiZnw",
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"
}
 
Top