Hi All,
I recently overcame an annoying challenge and thought I'd share to save anyone else the time of they encounter the same pain.
Source data description:
Using Powershell on-premises we generate a PSCustomObject which lists disabled computers , I borrow this report which gets sent out via e-mail , I save the report as JSON using powershell's ConvertTo-JSON cmdlet and action the trigger using the Flag e-mail trigger.
When trying to access this e-mail attachment I encountered some challenges :
1. Images in the e-mail are considered attachments , so I created an IF statement to look for the custom extension [*.JSON] , I used an expression similar to item()?['Name'] to help isolate the name property for the condition.
Example filter for specific attachment
2. Challenge # 2 was that attachment data is encoded , thus I employed an expression to decode the base64 data.
Garbage characters parsing JSON
Pictured below is a successful parse using UTF-8.Successfully Parsed JSON
Hopefully by sharing this , I save others from the pain.
**UPDATE** I found out that UTF8-BOM seemingly adds a header character that MS Flow really doesn't like.
I used an online JSON Editor which helped me understand why I was getting this error all of a sudden.
Copied and pasted text from the error to identify the root cause as a header byte which occurs as a result of transporting JSON as a UTF8-BOM file.
This is a brilliant Flow recipe! 👌🏼😁
Happy Flowing!