Fun JSON question

Ok, I have the following JSON string (some things are removed for
privacy):

addresses = [{“address”: {“lng”: “-178.7098”,“lat”: “43.2818”}},
{“address”: {“lng”: “-178.7041”,“lat”: “43.2789”}}, {“address”:
{“lng”: “-178.7004”,“lat”: “43.273”}}]

and I am attempting to call them like so:

for(i=0;i<addresses.length;i++) {
alert( addresses[i].lat);
}

However, the alert comes back saying “undefined”.

Any idea what I am doing wrong?

On 12 Jul 2008, at 03:08, Jeff.Corcoran wrote:

for(i=0;i<addresses.length;i++) {
alert( addresses[i].lat);
}

the way you’ve got your json setup you need to be poking
addreses[i].address.lat

Fred