Concatenation logic

Hello All,

Need some quick insights on below logic

Following I have set 1 and need to convert this in to expected output mentioned below

 

Set1 has name =A repeated thrice with different roles DO,EO,QI;so need an output A = DO,EO,QI

local!set1: {  
{
"name": "A",
"role": "DO"
},
{
"name": "A",
"role": "EO"
},
{
"name": "A",
"role": "QI"
},
{
"name": "B",
"role": "IO"
}
}

 

Expected Output should be like below

----------------

{
     {
           "name": "A",
          "role": "DO,EO,BI"
     },
    {
           "name": "B",
           "role": "IO"
      }
}

  Discussion posts and replies are publicly visible