原来的数据格式:
我需要的格式:
const array = [
{
key:"name",
value:"testpostman22"
},
{
key:"remark",
value:"测试postman22"
}]
const arrayToObject = array => {
const result = {}
array.forEach(item => {
result[item.key] = item.value
})
return result
}
arrayToObject(array)