我有以下数据结构:循环通过数据结构中的CoffeeScript
{
data: [
{
id: 5,
name: 'ItemOne'
},
{
id: 14,
name: 'ItemTwo'
},
{
id: 15,
name: 'ItemThree'
}
]
}
而且我想通过它循环,但我挣扎。我试过了:
for result,value of results
console.log results
item = 0
message = "Component: " + value[item]['name'] + " Status: " + value[item]['status']
output.push message
item++
但它只返回一个结果。我显然已经离开了,但我需要做什么?
你所示的数据结构是无效的,它有很多错误。 – thefourtheye
Json语法错误。写入有效的json。 – sandipon
我更新了数据结构,我不得不修改原来的内容,并且没有错误检查它 – jaxxstorm