【发布时间】:2016-09-20 13:03:33
【问题描述】:
我怎样才能把这个对象转换成一个里面有对象的数组?
beacons = {
"key": {
"one": "char",
"two": "sue",
"three": "johnny"
},
"key2": {
"one": "char",
"two": "sue",
"three": "johnny"
},
"key3": {
"one": "char",
"two": "cara",
"three": "johnny"
}
}
结果应该类似于下面的结果,我应该以这样的方式调用属性:beaconsArray[1].one ---> "char"
beaconsArray = [{
"one": "char",
"two": "sue",
"three": "johnny"
}, {
"one": "char",
"two": "sue",
"three": "johnny"
}, {
"one": "char",
"two": "sue",
"three": "johnny"
}]
【问题讨论】:
-
欢迎来到 Stack Overflow!请带上tour,四处看看,通读help center,尤其是How do I ask a good question?
-
订单可能不稳定。
-
@T.J.Crowder 感谢代码块更正! =)
标签: javascript arrays object transform