为了账号安全,请及时绑定邮箱和手机立即绑定

nodejs数组转json对象数组

nodejs数组转json对象数组

墨色风雨 2019-04-10 20:48:47
我想把一个有规律的数组转成json对象的数组呢,如下:数组["3040131111","小明","1","大学体育Ⅰ","通识课","2.00","75","总评成绩","2.50","A16603001A","32.00","3040133109","小明","1","基础英语Ⅰ","通识课","4.00","80","总评成绩","3.00","A17001021A","64.00"]转成这种[{"学号":"3040111111","姓名":"小明","学期":"1","课程":"大学体育Ⅰ","类别":"通识课","学分":"2.00","成绩":"75","成绩类型":"总评成绩","绩点":"2.50","课程彪悍":"A16603001A","课时":“32.00”},{"学号":"3040111111","姓名":"小明","学期":"1","课程":"大学体育Ⅰ","类别":"通识课","学分":"2.00","成绩":"75","成绩类型":"总评成绩","绩点":"2.50","课程彪悍":"A16603001A","课时":“32.00”}]用什么方法去做呢?
查看完整描述

2 回答

?
繁花如伊

TA贡献2012条经验 获得超12个赞

你的key都是一样的,可以存成一个数组,把你的原数据按每11个一取,然后分别按key和value遍历进对象,最后push进结果数组。
                            
查看完整回答
反对 回复 2019-04-10
  • 2 回答
  • 0 关注
  • 550 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信