json对象转二维字符数组
转换前
[
{
"organizenm": "星期一","major00": "1","major11": "0", "major22": "0","major33": "0",
"major44": "1","major55": "0", "major66": "0", "major77": "0","major88": "0","major99": "0"
},
{
"organizenm": "星期二", "major00": "5", "major11": "0", "major22": "5","major33": "0",
"major44": "0","major55": "0","major66": "0", "major77": "0","major88": "0","major99": "0"
},
{
"organizenm": "星期三","major00": "13","major11": "2","major22": "0","major33": "6",
"major44": "0", "major55": "5","major66": "0", "major77": "0","major88": "0","major99": "0"
},
{
"organizenm": "星期四","major00": "15","major11": "0","major22": "0","major33": "0",
"major44": "0", "major55": "0","major66": "5", "major77": "0", "major88": "0", "major99": "10"
},
{
"organizenm": "星期五", "major00": "1","major11": "0", "major22": "0", "major33": "0",
"major44": "0","major55": "0","major66": "0", "major77": "0", "major88": "1","major99": "0"
},
{
"organizenm": "星期六","major00": "3", "major11": "0","major22": "0","major33": "0",
"major44": "0", "major55": "0", "major66": "0", "major77": "3","major88": "0","major99": "0"
}
]
转换后
[
[
"星期一","1", "0","0", "0","1","0","0", "0","0","0"
],
[
"星期二", "5","0","5", "0", "0","0","0","0","0","0"
],
[
"星期三","13","2", "0", "6", "0", "5","0", "0","0","0"
],
[
"星期四", "15", "0", "0", "0","0", "0", "5","0","0","10"
],
[
"星期五","1","0","0","0","0", "0","0","0","1", "0"
],
[
"星期六","3","0", "0", "0", "0","0","0","3", "0", "0"
]
]
转换方法
var list = [ ]//原始的json对象;
// return list
var arr = []//定义一个空数据用来存储处理后的结果
for (item in list) {
var res = []
item.each((key, value) => {
res.push(value)
})
arr.add(res)
}