I am not quite sure what I am doing wrong, I have called the distancematrix API and I retrieve this value as a result:-
{
“destination_addresses”:[“Werrikimbe NSW 2446, Australia”],
“origin_addresses”:[“Melbourne VIC 3000, Australia”],
“rows”:[{“elements”:[{“distance”:{“text”:“1,295 km”,“value”:1294637},“duration”:{“text”:“13 hours 8 mins”,“value”:47279},“status”:“OK”}]}],“status”:“OK”
}
I can then retrieve the result.rows; My problem is when I try to go any further for some reason.
I am specifically trying to retrieve the distance value, I need to determine the closest store to whatever location a person puts in.
When I try to use result.rows.elements.distance.value; for example, it won’t work. I also tried result.rows[0] and I don’t get just the contents of elements for example.