Power Automate Remove Elements from JSON Array

Posted by John Liu on Monday, July 29, 2024

In Power Automate, when processing JSON array, you might need to remove unwanted elements from the JSON array. When you read an Excel worksheet from OneDrive or SharePoint, the result is a JSON array and two internal elements (@odata.etag and ItemInternalId) will be added into the result JSON array.

To remove the @odata.etag and ItemInternalId from the result array, add a Select data operation action. Set the From value to be expression:

 json(replace(string(outputs('Compose_-_Excel_Table_contents')), '"@odata.etag"', '"odata_ExcelInternal"'))

and set the Map value to be expression:

removeProperty(removeProperty(item(), 'odata_ExcelInternal'), 'ItemInternalId')

In the From value, we use expression to replace ‘"@odata.etag"’ to ‘“odata_ExcelInternal”’ because removeProperty function doesn’t work with any field name with a period/fullstop in it.