I have a list like this
{
"user_email": "[email protected]",
"duration": 320
},
{
"user_email": "[email protected]",
"duration": 167,
},
{
"user_email": "[email protected]",
"duration": 450
}
and I need to build a new list groupig by user_mail and sum the duration
I need to obtain a list like this
{
"user_email": "[email protected]",
"duration": 167,
},
{
"user_email": "[email protected]",
"duration": 770
}
I would complete that transformation with a Tray.io script step containing the following code:
The original array of objects is passed as "data" on the input.
Resulting script output
Script step and input