Generate an array using info collected through looping

Answered

Hi,

I've collected information of some product variants using 'for each loop'. Now I want to create a 'variants' array that contains all products and the their info.

This is the array that I have managed to create:

What do I have to do in order to make the response look like this (see below)?

variants: [
{'Name': 'Black shirt',
'Description: 'Very good',
'Color': 'Black'},

{'Name': 'Red shirt',
'Description: 'Very bad',
'Color': 'Red'}

]


More info about what I have until now:

2 replies