I'm trying to convert an array into an object
"loanArray" : [
{
"recordID" : "LKOCH123",
"date" : "20221206",
"productId" : "21023"
}
]
I've converted this into an Object using Object.assign like below:
let loanObj= Object.assign({}, loanArray)
"loanObj" : {
"0": {
"recordID" : "LKOCH123",
"date" : "20221206",
"productId" : "21023"
}
}
However, I want to remove that "0" position in my object, and the expected is below: please help to achieve this structure.
"loanObj" : {
"recordID" : "LKOCH123",
"date" : "20221206",
"productId" : "21023"
}