John Smith
John Smith

Reputation: 11

logic app Unable to extract json from email attachment

So l am trying to extract json file from an email attachment.

I then l try to parse json the file but don't get the content of the json file itself.

enter image description here

What l want to then do is assign the first and last name to a variable and use that later on in the logic app.

I have used a combination of the following for the content in the json control :

base64(triggerBody()?['attachments']?['ContentBytes'])

base64ToString(body('Getattachment')?['attachments']?['ContentBytes'])

but keep the following message :

Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'The template language expression 'body('GetAttachment')?['Attachments'][0]?['ContentBytes']' cannot be evaluated because property '0' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

Upvotes: 0

Views: 181

Answers (1)

RithwikBojja
RithwikBojja

Reputation: 11363

It worked for me using below design:

enter image description here

base64ToString(body('Get_Attachment_(V2)')?['contentBytes'])

enter image description here

Input attachment:

{
"firstName":"Rithwik",
"lastName":"Bojja"
}

enter image description here

Output:

enter image description here

Upvotes: 0

Related Questions