我的JSON对象是这样的:如何显示json对象到html?
[{
"attributes": {
"Code": "SGL",
"Total": "19421340.27"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "4900439.85"
}, {
"Date": "2016-07-23",
"Rate": "4845150.21"
}, {
"Date": "2016-07-24",
"Rate": "4845150.21"
}, {
"Date": "2016-07-25",
"Rate": "4830600"
}]
}, {
"attributes": {
"Code": "DBL",
"Total": "6473780.09"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "1633479.95"
}, {
"Date": "2016-07-23",
"Rate": "1615050.07"
}, {
"Date": "2016-07-24",
"Rate": "1615050.07"
}, {
"Date": "2016-07-25",
"Rate": "1610200"
}]
}, {
"attributes": {
"Code": "QUAD",
"Total": "6473780.09"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "1633479.95"
}, {
"Date": "2016-07-23",
"Rate": "1615050.07"
}, {
"Date": "2016-07-24",
"Rate": "1615050.07"
}, {
"Date": "2016-07-25",
"Rate": "1610200"
}]
}]
从JSON对象数组,我要显示这样的形象:
我有尝试,但我仍然感到困惑。 我觉得无法做到。
我尝试循环中循环是这样的:
countRoomType = json_object.length;
for(var i=0; i<countRoomType; i++){
countDayPrice = json_object[i].DayPrice.length;
for(var j=0; j<countDayPrice; j++){
...
}
}
任何解决方案来解决我的问题呢?
试的jQuery插件模板 –
@DharaParmar,见我的问题。我更新它 –
我尝试循环循环,但我仍然困惑。这似乎是错误的 –