My JSON data structure has the following format:
....
"location" : {
"lat" : 37.42140090,
"lng" : -122.08537010
},
....
I am having trouble accessing the lat and lng values. Any suggestions on how to do this?
Currently, my code is as follows:
results[0].geometry.location.lat
or results[0].geometry.location.lng
Unfortunately, this code does not seem to work. Oddly enough, I get the output when only using results[0].geometry.location.
The specific JSON dataset I am working with can be found here: http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true
Update --
This is the method I am utilizing to send a request to the API
geocoder.geocode( { 'address': search_addr}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var t = results[0].geometry.location.lat;
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
Thank you