0

want to group by unique resubmit value - 1, 2 etc, and push all the json objects to the corresponding resubmit array.

I would like to construct the json array ab, and build the expected output - and group the json objects based on noOfResubmit values.

input:

    const ab =  [
{
    "Round": 1,
    "noOfResubmit": 1,
    "row": 0,
    "date": "Nov 24 - 30",
    "week": "Tuesday - Monday"
},
{
    "Round": 1,
    "noOfResubmit": 1,
    "row": 1,
    "date": "Nov 8 - 14",
    "week": "Sunday - Saturday"
},{
    "Round": 1,
    "noOfResubmit": 2,
    "row": 4,
    "date": "Sep 1 - 14",
    "week": "Tuesday - Monday"
},
{
    "Round": 1,
    "noOfResubmit": 2,
    "row": 5,
    "date": "Jan 1 - 7",
    "week": "Thursday - Wednesday"
}

]

    Expected output: 
        const c ={
            "1": [{
                    "Round": 1,
                    "noOfResubmit": 1,
                    "row": 0,
                    "date": "Nov 24 - 30",
                    "week": "Tuesday - Monday"
                }, {
                    "Round": 1,
                    "noOfResubmit": 1,
                    "row": 1,
                    "date": "Nov 8 - 14",
                    "week": "Sunday - Saturday"
                }],
            "2": [
                {
                    "Round": 1,
                    "noOfResubmit": 2,
                    "row": 4,
                    "date": "Sep 1 - 14",
                    "week": "Tuesday - Monday"
                },{
                    "Round": 1,
                    "noOfResubmit": 2,
                    "row": 5,
                    "date": "Jan 1 - 7",
                    "week": "Thursday - Wednesday"
                }]
            }

can you advise how to construct the expected output?

Banu
  • 37
  • 6

0 Answers0