Issue
I have a object and i want to convert it to be like number of objects
see this is a object -
[{
"type_width": "245",
"type_height": "60",
"type_size": "21"
}]
and want to convert this object like:
[{ "Type Width": "245"},{"Type Height": "60"},{"Type Size": "21"}]
Solution
You can use Object.entries and map
let arr = [{ "width": "245","height": "60","size": "21"}]
let op = Object.entries(arr[0]).map(([key,value]) => ({[key]: value}) )
console.log(op)
Answered By - Code Maniac
Answer Checked By - - David Marino (ReactFix Volunteer)