-2

enter image description here

i tried the following

document.getElementById("printnickname").innerHTML = myObject.data.503913138.nickname;
document.getElementById("printnickname").innerHTML = myObject.data[0].nickname;
document.getElementById("printnickname").innerHTML = myObject.data[1].nickname;
document.getElementById("printnickname").innerHTML = myObject.data."503913138".nickname;

none of which work.

Ross
  • 14,266
  • 12
  • 60
  • 91
  • Duplicate of http://stackoverflow.com/questions/23552708/how-to-parse-json-with-number-as-a-key – JJJ Jun 08 '14 at 08:23
  • Ok, i see it now. Javascript always converts numeric keys to string, so you have to use the array notation, instead of the dot one. Try the solution above. – Gregorio Setti Jun 08 '14 at 08:25
  • thank you all for help. im sorry that i didnt see that this question had already been asked – user2630246 Jun 08 '14 at 08:26

1 Answers1

1

I don't know exactly the data structure, but maybe you could try

myObject.data["503913138"].nickname;

if data is an array and that number is a key of that array.

Gregorio Setti
  • 321
  • 3
  • 9