# Group Aggregation Issue

**URL:** <https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746>\
**Category:** SHF Discussion and Questions\
**Tags:** webservice-connector, sailpoint-identity-security\
**Created:** [May 23, 2024, 11:02am UTC](https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746 "2024-05-23T11:02:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![schattopadhy](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/schattopadhy/32/8854_2.png) [@schattopadhy](https://developer.sailpoint.com/discuss/u/schattopadhy)\
**Post date:** [May 23, 2024, 11:02am UTC](https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746/1 "2024-05-23T11:02:29Z")

</div>

Hi All,

Can anyone give any solution for reading groups if they are in the below format using after rule

 ![image](https://global.discourse-cdn.com/sailpoint/original/2X/8/8e1bd0953b383ea5045e7cd2cfbe87f99fd16aff.png)

```auto
typimport java.io.StringWriter; 
import java.text.SimpleDateFormat; 
import sailpoint.tools.GeneralException; 
import com.google.gson.Gson; 
import org.json.*; 
import sailpoint.integration.*; 
 
 
List list = new ArrayList(); 
Map response = new Gson().fromJson(rawResponseObject, Map.class); 
 
List Finallist = new ArrayList(); 
log.info(\"Get raw response\"+response); 
 
list = response.get(\"resources\"); 
log.info(\"get List\"+list); 
 
    for(int d = 0; d < list.size(); d++ ){ 
      Map responseMap = (Map) list.get(d); 
 
 
        Map newmap = new HashMap(); 
        newmap.put(\"id\", responseMap.get(\"id\")); 
       Finallist.add(newmap); 
  } 
 
Map updatedMapInfo = new HashMap(); 
updatedMapInfo.put(\"data\", Finallist); 
log.info(\"Get Final List\"+Finallist); 
 
return updatedMapInfo; 
    

```

I am trying with the above sample code but facing issues

---

<div class="post-metadata">

**Author:** ![ashutosh08](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ashutosh08/32/11459_2.png) [@ashutosh08](https://developer.sailpoint.com/discuss/u/ashutosh08)\
**Post date:** [May 23, 2024, 11:15am UTC](https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746/2 "2024-05-23T11:15:12Z")

</div>

> [@schattopadhy](#):
>
> `responseMap.get(\"id\")`

Why are you using get in this format? Because as per example it should be a string. Is it that group will be in expanded format and just for the case of showing you did not expand it?

Also, if possible, please share error that you are getting.

Thanks

---

<div class="post-metadata">

**Author:** ![Ankit\_PwC](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@Ankit\_PwC](https://developer.sailpoint.com/discuss/u/Ankit_PwC)\
**Post date:** [May 23, 2024, 11:32am UTC](https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746/3 "2024-05-23T11:32:16Z")

</div>

Could you try storing the group as a String instead of a Map to pass it directly in the newmap

> [@schattopadhy](#):
>
> `Map responseMap = (Map) list.get(d); `

String response = list.get(d);

> [@schattopadhy](#):
>
> `newmap.put(\"id\", responseMap.get(\"id\")); `

newmap.put(\“id\”, response);

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 22, 2024, 11:32am UTC](https://developer.sailpoint.com/discuss/t/group-aggregation-issue/57746/4 "2024-07-22T11:32:51Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
