treating json like an array
- by tawheed
I was doing some test with json and ran into serveral issues. hope somebody on this mailing list can help out.
localStorage[LOC] = JSON.stringify(track);
var boy = localStorage[LOC];
alert(boy);
This is the data I get back
[{"lat":42.5877511,"lng":-71.7873177,"acc":67,"date":"Sat Apr 14 2012 01:03:46 GMT-0400 (EDT)"}]
I was wondering how I could access the json objects like we do in a regular array.
For debugging purposes I did something like,
alert(boy[0].lat);
But the result I got back was undefined