I'm currently processing some json encoded data, but I can't access it properly, this are some tests I did:
Code fragment 1:
var json = [
{"MarkerId":1,"0":1,"UserId":2147483647,"1":2147483647,"locX":51,"2":51,"LocY":4,"3":4},
{"MarkerId":2,"0":2,"UserId":2147483647,"1":2147483647,"locX":55,"2":55,"LocY":4,"3":4}];
console.log(json[0][0]);
outputs:
1
Code fragment 2:
var json2 = getCookie('markers');
console.log(json2[0][0]);
outputs:
[
Code fragment 3:
console.log(getCookie('markers'));
output:
[{"MarkerId":1,"0":1,"UserId":2147483647,"1":2147483647,"locX":51,"2":51,"LocY":4,"3":4},{"MarkerId":2,"0":2,"UserId":2147483647,"1":2147483647,"locX":55,"2":55,"LocY":4,"3":4}]
as you can see when I use the result from test 3 hardcoded I can access it fine, but when I use it only in code i get something diffrent
does anyone know how to do this?