循環,這是我的JSON灰塵通過JS對象的JSON
{
"Undergraduate":{
"metaid":"0770",
"Offcampus":{
"FeesItems":{
"tuition":{
"label":"Tuition Fees",
"value":"5,870"
},
"comprehensive":{
"label":"Comprehensive Fees",
"value":"2,141"
},
"studentActivity":{
"label":"Student Activity Fees",
"value":"190"
},
"academicExcellence":{
"label":"Academic Excellence Fee",
"value":"225"
},
"room":{
"label":"Room",
"value":"0"
},
"board":{
"label":"Board",
"value":"0"
},
"livingAllowance":{
"label":"Living Allowance",
"value":"9,738"
}
}
}
}
}
我想通過項目環內FeesItems對象..
{#Undergradaute.Offcampus.FeesItems}
{label}, {value}{~n} <!-- What should be given in this line? -->
{/Undergradaute.Offcampus.FeesItems}
我不能修改實際的JSON,是有沒有辦法做到不改變json?如果不是dust.js,還有其他的模板如鬍子,把手? – NEO
@NarendranSankaran我用你的問題的解決方案更新了郵政。希望它有幫助 – Dalorzo
有沒有辦法通過'key'關鍵字引用對象鍵?這是我的問題http://stackoverflow.com/questions/29554132/does-dust-js-provide-a-way-to-reference-an-object-key-value-by-keywords-key-an – Green