【发布时间】:2021-06-13 12:25:08
【问题描述】:
我有以下 JSON 数据:
{
"0": {
"jQuery331045811028719032642": {
"stepCount": 1,
"captionSize": 0,
"countdown": true,
"countdownAlertLimit": 10,
"displayCaptions": false,
"displayDays": 0,
"displayHours": true,
"fontFamily": "Verdana, sans-serif",
"fontSize": 0,
"lang": "en",
"languages": {},
"seconds": 2609,
"start": true,
"theme": "white",
"width": 4,
"height": 30,
"gap": 11,
"vals": [0, 0, 4, 3, 2, 9],
"limits": [2, 9, 5, 9, 5, 9],
"iSec": 5,
"iHour": 1,
"tickTimeout": 1000,
"intervalId": 1,
"tickCount": 0,
"timeTo": "2021-06-12T15:14:00.000Z",
"options": {
"timeTo": "2021-06-12T15:14:00.000Z",
"start": true,
"theme": "white",
"seconds": 2609
},
"sec": 2609,
"ttStartTime": 1623508230144
},
"jQuery331045811028719032641": {
"hasDataAttrs": true
}
},
"length": 1
}
假设上面的数组变量是var data;
对于这个子数组jQuery331045811028719032642 是自动生成的。
我的问题,如何使用 jQuery 获取 seconds 数组值?
我试过了:
alert(data[0].seconds);
但它返回未定义。
【问题讨论】:
-
完整对象中没有
seconds数组。
标签: javascript jquery json