简体   繁体   中英

Unable to retrieve data from content JSON using liquid in logic apps

I have a logic app that receives data from another logic app. Everything seems to work, and I see data coming in in the input, see image below. 逻辑应用步骤的输入

After this, I try to transform it using liquid. This is my template:

液体模板

I know for a fact, that the liquid template does get applied. See the image below, where you can see the liquid template structure being made and even adding the hardcoded strings as in the template. 液体模板后的结果

As you can see, it seems I am unable to select the "Flights" array and even simple properties as these seem to be empty in the result json object. Any idea why I could have this issue?

Seems like a content type issue to me before making http request, Let me explain it in the steps.

  • Here is my liquid template which i tried:

  { "Employee Name" : "{{ content.firstname }} {{ content.lastname }}", "Company Name" : "{{ content.company }}", "Date Of Joining" : "{{ "now" | Date: "MM/dd/yyyy" }}", "Department" : "{{ content.department }}", "Technology" : "{{ content.work | Size }}", "Skills" : [ {% for Skill in content.work %} { "Name" : "{{ Skill.skil }}", "Marks" : {{ Skill.mark }} }, {% endfor %} ] } 

  • Here is my input file i was trying through postman:

  { "firstname" : "Kamlesh", "lastname" : "Kumar", "company" : "Microsoft", "department" : "Interface Technology", "work" : [ { "skil" : "BizTalk Server", "mark" : 95 }, { "skil" : "Logic Apps", "mark" : 95 }, { "skil" : "Azure", "mark" : 85 }, { "skil" : "SQL Server", "mark" : 95 } ] } 

When i am making a http request from postman it gives me following result

  { "Employee Name": " ", "Company Name": "", "Date Of Joining": "08/05/2019", "Department": "", "Technology": "0", "Skills": [] } 

which is you are getting it too. To resolve it i added type before hitting HTTP request by doing below

在此处输入图片说明

and it worked for me. Please try and see if it work for you.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM