For example this the json which i get.Json group this
var data = [{
orderid: 1,
ordername:ordername1,
productcode: 1,
productname: product1,
productquantity: 10
},
{
orderid: 2,
ordername:ordername2,
productcode: 2,
productname: product2,
productquantity: 11
},
{
orderid: 1,
ordername:ordername3,
productcode: 3,
productname: product3,
productquantiy: 45
}
]
Expected output
[
{
orderid: 1,
ordername:ordername1,
products: [
{
productcode: 1,
productname: product1,
productquantity: 10
},
{
productcode: 3,
productname: product3,
productquantity: 45
}]
},
{
orderid: 2,
ordername:ordername2,
products: [
{
productid: 2,
productname: product2,
productquantity: 11
}]
}]
How to do this in react native.How to group this based on orderid.Now i have added ordername also so how to include that also