Grouping JSON records
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"
}
}
]
}
-
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.
0
Please sign in to leave a comment.
Comments
1 comment