I've tried various approaches, basically, if I have a red and a green option as one set, and another set of sizes, say small and large, I would need the following to be true:
const input = [{
label : 'Colours',
options: [{text : 'red'}, {text : 'green'}]
},{
label : 'Sizes',
options: [{text : 'small'}, {text: 'large'}]
}];
I would expect this output:
red, small,
red, large,
green, small,
green, large
Below is a more complicated but similar structure, which should also be able to generate from the same code:
[{"label":"Fitting Options","options":[{"text":"No Thanks","value":"no-thanks","price":0},{"text":"Yes Please (+$110.00 )","value":"yes-please","price":"110.00"}]},{"label":"Memory Card Size","options":[{"text":"128GB (+$180.00 )","value":"128gb","price":"180.00"},{"text":"16GB","value":"16gb","price":0},{"text":"32GB (+$30.00 )","value":"32gb","price":"30.00"},{"text":"64GB (+$80.00 )","value":"64gb","price":"80.00"}]}]
I used this as reference but can't quite reverse engineer it! Get all variants from a multidimensional array in javascript