I am trying to read JSON information (https://maps.googleapis.com/maps/api/geocode/json?address=Mountain+View+Amphitheatre+Parkway&sensor=false) from JavaScript using:
$.getJSON("https://maps.googleapis.com/maps/api/geocode/json?address="+city+"+"+steet+"&sensor=false", function(json) {
if (json.status == 'ZERO_RESULTS'){
alert('Wrong input');
}
else{
// Here I would like to read json.results.geometry.location.lat
}
});
But it does not work. If I try to read json.results, I get [object Object]. Because printing json gave me the same I thought I could just continue with periods, but it did not work.
After that I tried to iterate over json.results and after to parse the object to an array, but all did not work.
alert()it? If that is the case, don't;alert()isn't suitable for debugging, useconsole.log()instead.