var data= [
{
name: "productname",
id: "1356",
price: "0.00",
category: "Health",
position: "1",
list: "New Products",
stocklevel: "20",
brand: "Health"
},
{
name: "productname2",
id: "5263",
price: "0",
category: "Hair",
position: "2",
list: "New Products",
stocklevel: "",
brand: "Hair"
},
{
name: "productname3",
id: "7473",
price: "0.00",
category: "skin",
position: "3",
list: "New Products",
stocklevel: "10",
brand: "skin"
},
]
i have data of multiple product as in nested order the product could be upto n.
but i want this data into commma seprated values As list so i can make it anylaytical friendly.
Like this
Product1: "productname",
Product1Price: 0.00,
Product1id: "1356",
Product1brand: "health",
Product1stocklevel: "20",
Product2: "productname2",
Product2price: 0,
Product2id: "5263",
Product2brand: "hair",
Product2stocklevel: "",
Product3: "productname3",
Product3price: 0.00,
Product3id: "7473",
The product details should be show out of the nexted loop
We can separate key and values with map function. But as all product data is in same format so i am confused about how map function would work here.