So the question is how to:
- parse JSON or CSV file
- take each value only one and erase NULLs
- separate each value by a column or semi column
- insert that into the e-mail recipient in Logic App.
CodePudding user response:
After reproducing from my end, I could able to get this work by Parsing the json initially. Considering below is the Json, I have used Parse JSON action in order to extract tags_createdBy
column.
[
{
"location": "westeurope",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "westeurope",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "germanywestcentral",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "westeurope",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "switzerlandnorth",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.compute/virtualmachines"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.sql/servers/databases"
},
{
"location": "westeurope",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "switzerlandnorth",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "germanywestcentral",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "germanywestcentral",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "[email protected]",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "eastus",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.storage/storageaccounts"
},
{
"location": "westeurope",
"name": "Resource",
"tags_createdBy": "",
"type": "microsoft.storage/storageaccounts"
}
]
Here is the flow of my logic app which extracts tags_createdBy
from the json and saves it in an array variable using Append to array variable
.
To remove duplicates and get only the unique values, I have used union
and filtered the array to remove null
values from the resultant. Below is the expression and the flow used in my logic app.
union(variables('tags_createdBy'),variables('tags_createdBy'))
Expression to replace ',' with ';'
replace(string(body('Filter_array')),',',';')
RESULTS: