1
我需要得到这个对象:变量作为JavaScript属性名对象常量
{
"1": {
"epg": {
"title1": "TITLE",
"start1": "10:00",
"stop1": "12:50",
"description1": "DESC",
"percent1": "17",
"step1": "2"
}
},
"2": {
"epg": {
"title2": "TITLE",
"start2": "13:50",
"stop2": "14:00",
"description2": "DESC",
"percent2": "-262",
"step2": "7"
}
}
}
我写这篇文章的代码:
/* MAKE - 5 shows epg */
for (i = 0; i < 2; i++) {
data.push({i: {"epg": {"title1": "", "start1": "", "stop1": "", "description1": "", "percent1": "", "step1": ""}}});
};
/* SEND - 5 shows epg */
res.json(data);
,我得到这样的输出:
[{"i":{"epg":{"title1":"","start1":"","stop1":"","description1":"","percent1":"","step1":""}}},{"i":{"epg":{"title1":"","start1":"","stop1":"","description1":"","percent1":"","step1":""}}}]
这是不正确的......你能否给我提示功能或如何去做。
'数据[i] = {EPG:...};' –