原始数据
let data = [
[
45496,
"生产二班",
"刘跃"
],
[
45497,
"生产一班",
"魏静波"
],
[
45498,
"生产二班",
"杨路群"
]
]
转换方法
const extractedData = [];
for (let i = 0; i < data.length; i++) {
const [DataAttendance, ClassName, EmpName] = data[i];
extractedData.push({ DataAttendance, ClassName, EmpName });
}
转换结果
[
{
"DataAttendance": "2024-07-23 08:00:00",
"ClassName": "生产二班",
"EmpName": "刘跃"
},
{
"DataAttendance": "2024-07-24 08:00:00",
"ClassName": "生产一班",
"EmpName": "魏静波"
},
{
"DataAttendance": "2024-07-25 08:00:00",
"ClassName": "生产二班",
"EmpName": "杨路群"
}
]