0

I have objects inside an object returned from a REST API as such:

const json = { 
"0": {
"barcode": "897382173",
"img": "-",
"name": "Lemon",
"productId": "DC-PR111113"
},

 "1": {
"barcode": "697382173",
"img": "-",
"name": "Aloe",
"productId": "DC-PR111113"}
}

there is a curly-braces at the start and at the end

And I need to take those objects (0 and 1) out, and place it in array like this

const json = [
"0": {
"barcode": "897382173",
"img": "-",
"name": "Lemon",
"productId": "DC-PR111113"
},


 "1": {
"barcode": "697382173",
"img": "-",
"name": "Aloe",
"productId": "DC-PR111113"}
}
]

I tried so many things but still have no luck :(

0 Answers0