我想把一个有规律的数组转成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” } ]
键名要英文哦 自豪地采用 CNodeJS ionic
遍历数组 根据数组的下标添加上键名,自己琢磨一下 一点也不难 自豪地采用 CNodeJS ionic
@hoozi 能稍微再详细一点吗?不太懂哎
你一个数组里面有多个集合,你就祈祷结构不会变吧
@captainblue2013 已经搞定了,循环取出,结构是不变的,写的爬虫,爬表格
循环一遍,新建一个Object,对应赋值给Object,再push到一个空数组 即可