Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
Grouping json object

I am creating dynamic variation and this is my JSON output for variation.

[
    {
        variant: {
            name: 'Size',
            code: 'size',
            type: 'text',
            options: [
                {value: 'Small'},
                {value: 'Medium'},
                {value: 'Large'},
                {value: 'Extra Large'},
            ]
        }
    },
    {
        variant: {
            name: 'Color',
            code: 'color',
            type: 'text',
            options: [
                {value: 'Red'},
                {value: 'Green'},
                {value: 'Blue'},
            ]
        },
    }
]

Now i want to group the options value to get the below result from above JSON. But it is totaly not making me send how i'll group it like that.

    props.modelValue.forEach(({variant}) => {
        variant.options.forEach((value) => {
            console.log(value)
        });
    });


[
        {'size':'Small','color':'Red'},
        {'size':'Small','color':'Green'},
        {'size':'Small','color':'Blue'},

       {'size':'Medium','color':'Red'},
       {'size':'Medium','color':'Green'},
       {'size':'Medium','color':'Blue'},

       {'size':'Large','color':'Red'},
       {'size':'Large','color':'Green'},
       {'size':'Large','color':'Blue'},

       {'size':'Extra Large','color':'Red'},
       {'size':'Extra Large','color':'Green'},
       {'size':'Extra Large','color':'Blue'},
    ]
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!