# Grouping JSON records

**URL:** <https://connective.celigo.com/t/grouping-json-records/590>\
**Category:** Integrator.io\
**Tags:** script, grouping, transformation, json\
**Created:** [December 2, 2022, 5:04pm UTC](https://connective.celigo.com/t/grouping-json-records/590 "2022-12-02T17:04:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markpierson](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@markpierson](https://connective.celigo.com/u/markpierson)\
**Post date:** [December 2, 2022, 5:04pm UTC](https://connective.celigo.com/t/grouping-json-records/590/1 "2022-12-02T17:04:50Z")

</div>

Hi Community,

I am looking for suggestions on the best way to tackle grouping JSON records by a sub field in the record and accumulate another subfield.

In the example below, I need to group time entries by "client.name" as the header record. For each client.name in the full API response, I need line items for each "project.name" for that customer with total "hours" per project.  
I am thinking that I will need to do all this in a script, but I want to see if there is a more elegant way to do this transformation.  
{  
 "time\_entries": [  
 {  
 "id": 1948186599,  
 "spent\_date": "2022-12-02",  
 "hours": 3,  
 "hours\_without\_timer": 3,  
 "rounded\_hours": 3,  
 "notes": "RFgen - Updated Bin Sorting query to prioritize non pallet rack shelf types",  
 "user": {  
 "id": 2259267,  
 "name": "Joe Consultant"  
 },  
 "client": {  
 "id": 9234115,  
 "name": "Sample CO",  
 "currency": "USD"  
 },  
 "project": {  
 "id": 30302466,  
 "name": "Support",  
 "code": "Consulting"  
 }  
 }  
 ]  
}

---

<div class="post-metadata">

**Author:** ![tylerlamparter](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/tylerlamparter/32/9204_2.png) [@tylerlamparter](https://connective.celigo.com/u/tylerlamparter)\
**Post date:** [December 2, 2022, 5:52pm UTC](https://connective.celigo.com/t/grouping-json-records/590/2 "2022-12-02T17:52:49Z")

</div>

This currently isn't supported, but I logged an enhancement request for the idea. It could be done in a script, but you would need to be careful with how large your page size is. If all your records fit within one 5 MB page, then it's doable there.
