Reputation: 193
Current Invalid Input
boxlist = [ { boxId:'94sdsd65cc9' boxSize:'Small' boxType:'box' items:(2) [Array(12), Array(2)] } ]
Expanded above Items array of array sample:
items : [ [{id: 1, name: "item1", write: true}], [{id: 3, name: "item3", write: true}] ]
Expected Output
boxlist = [ { boxId:'94sdsd65cc9' boxSize:'Small' boxType:'box' items:(2) [{.12.}, {.2.}] } ]
Required Items array of objects sample:
items = [ {id: 1, name: "item1", write: true}, {id: 3, name: "item3", write: true} ]
Tried to use
Upvotes: 0
Views: 62
Reputation: 521
boxlist.map((list) => {
list.items = list.items.flat() // flattens the array of array
return list
})
Upvotes: 1