I have got an array of objects from backend as follows, which i need to convert to an array in react js. I have got the object using Object.values(obj)[0], however i can’t push the objects into a new json array.
Note: Item names are dynamic, means objects cannot be mapped using particular item name.
“Name of the Company” can be “Name”.
Any help would be appreciated.
My Object :
[
[
"Name of the Company", "TCS"
],
[
"Salary", 85000
],
[
"Joining Date", "23/07/2019"
],
[
"", ""
],
[
"Currency", "INR"
],
]
Desired Output :
[
{
"Name of the Company": "TCS",
"Salary": 85000,
"Joining Date": "23/07/2019",
"Currency": "INR"
}
]
Thanks in Advance.