This is an example of how to do it using nothing but standard actions in LogicApps ...

Create a new LogicApp and load the definition into it via the Code View.
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": [
"@variables('Result Object')"
],
"runAfter": {
"For_Each_Item": [
"Succeeded"
]
},
"type": "Compose"
},
"For_Each_Item": {
"actions": {
"Does_Current_ID_Exist_In_Result_Object": {
"actions": {
"Add_Property_(Step_1)": {
"inputs": "@setProperty(variables('Result Object'), variables('Current ID'), body('Filter_Data_For_Current_ID'))",
"runAfter": {
"Filter_Data_For_Current_ID": [
"Succeeded"
]
},
"type": "Compose"
},
"Add_Property_(Step_2)": {
"inputs": {
"name": "Result Object",
"value": "@outputs('Add_Property_(Step_1)')"
},
"runAfter": {
"Add_Property_(Step_1)": [
"Succeeded"
]
},
"type": "SetVariable"
},
"Filter_Data_For_Current_ID": {
"inputs": {
"from": "@variables('Data')",
"where": "@equals(item()['Id'], variables('Current ID'))"
},
"runAfter": {},
"type": "Query"
}
},
"expression": {
"and": [
{
"equals": [
"@variables('Result Object')?[variables('Current ID')]",
"@null"
]
}
]
},
"runAfter": {
"Set_Current_ID": [
"Succeeded"
]
},
"type": "If"
},
"Set_Current_ID": {
"inputs": {
"name": "Current ID",
"value": "@{item()['Id']}"
},
"runAfter": {},
"type": "SetVariable"
}
},
"foreach": "@variables('Data')",
"runAfter": {
"Initialize_Current_ID": [
"Succeeded"
]
},
"runtimeConfiguration": {
"concurrency": {
"repetitions": 1
}
},
"type": "Foreach"
},
"Initialize_Current_ID": {
"inputs": {
"variables": [
{
"name": "Current ID",
"type": "string"
}
]
},
"runAfter": {
"Initialize_Result_Object": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Initialize_Data": {
"inputs": {
"variables": [
{
"name": "Data",
"type": "array",
"value": [
{
"Id": "1",
"age": "20",
"name": "xxx"
},
{
"Id": "1",
"age": "52",
"name": "yyy"
},
{
"Id": "5",
"age": "59",
"name": "zzz"
}
]
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Initialize_Result_Object": {
"inputs": {
"variables": [
{
"name": "Result Object",
"type": "object",
"value": {}
}
]
},
"runAfter": {
"Initialize_Data": [
"Succeeded"
]
},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}