How to get JSON objects value if it's name contains dots?

Posted by manakor on Stack Overflow See other posts from Stack Overflow or by manakor
Published on 2010-04-05T06:21:53Z Indexed on 2010/04/05 6:33 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

I have a very simple JSON array (please focus on "points.bean.pointsBase" object):

var mydata =   
{"list":  
  [  
    {"points.bean.pointsBase":  
      [  
        {"time": 2000, "caption":"caption text", duration: 5000},  
        {"time": 6000, "caption":"caption text", duration: 3000}  
      ]  
    }  
  ]  
};  

// Usually we make smth like this to get the value: 
var smth = mydata.list[0].points.bean.pointsBase[0].time; 
alert(smth); // should display 2000

But, unfortunately, it does display nothing.
When I change "points.bean.pointsBase" to smth without dots in it's name - everything works!

However, I can't change this name to anything else without dots, but I need to get a value?!
Is there any options to get it?

© Stack Overflow or respective owner

Related posts about JSON

Related posts about JavaScript