相关疑难解决方法(0)

如果JSON对象的名称包含点,如何获取它?

我有一个非常简单的JSON数组(请关注"points.bean.pointsBase"对象):

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
Run Code Online (Sandbox Code Playgroud)

但不幸的是,它确实没有显示任何内容.
当我将"points.bean.pointsBase"改为smth而没有点名时 - 一切正常!

但是,如果没有圆点,我无法将此名称更改为其他任何内容,但我需要获取值?!
有没有选择来获得它?

javascript arrays json object

94
推荐指数
4
解决办法
10万
查看次数

标签 统计

arrays ×1

javascript ×1

json ×1

object ×1