json_ext.get_string returns null, why?

2013-02-11
2013-05-28
  • Sergei Martens
    Sergei Martens
    2013-02-11

    I am building a procedure  that extracts the latitude and longitude from a json object i get from google.
    For extracting the latitude i use the following code (t_jsn_response is the json object i get from google):

    json_ext.get_string(t_jsn_response,'results.geometry.location.lat');

    Can someone tell me what i'm doing wrong, because json_ext.get_string is returning null?

    The json is as follows:
    {
       "results" : [
          {
             "address_components" : [
                {
                   "long_name" : "Oude Dijk",
                   "short_name" : "Oude Dijk",
                   "types" :
                },
                {
                   "long_name" : "Hoeven",
                   "short_name" : "Hoeven",
                   "types" :
                },
                {
                   "long_name" : "Halderberge",
                   "short_name" : "Halderberge",
                   "types" :
                },
                {
                   "long_name" : "North Brabant",
                   "short_name" : "NB",
                   "types" :
                },
                {
                   "long_name" : "The Netherlands",
                   "short_name" : "NL",
                   "types" :
                },
                {
                   "long_name" : "4741",
                   "short_name" : "4741",
                   "types" :
                }
             ],
             "formatted_address" : "Oude Dijk, 4741 Hoeven, The Netherlands",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 51.61077540,
                      "lng" : 4.60271280
                   },
                   "southwest" : {
                      "lat" : 51.58998530,
                      "lng" : 4.58745560
                   }
                },
                "location" : {
                   "lat" : 51.59972060,
                   "lng" : 4.594621699999999
                },
                "location_type" : "GEOMETRIC_CENTER",
                "viewport" : {
                   "northeast" : {
                      "lat" : 51.61077540,
                      "lng" : 4.60271280
                   },
                   "southwest" : {
                      "lat" : 51.58998530,
                      "lng" : 4.58745560
                   }
                }
             },
             "types" :
          }
       ],
       "status" : "OK"
    }

     
  • lat is not a string, but a number