How do I pass the correct variable to a liquid map? I'm using the HTTP GET request body but nothing is being sent to the liquid connector?

Mike Nanto 0 Reputation points
2024-04-12T05:03:47.9433333+00:00

I have an API that is structured like so:
I'm using the HTTP connector GET request to send the body to liquid json to json

{
    "items": [
        {
            "id": 1038155663,
            "number": "1234"
		},
        {
            "id": 1038155663,
            "number": "1234"		}
]
}

the issue I'm having is my output of the json to json connector is empty,

{%- for record in content.items -%}

and {%- for record in content -%}

isn't working. I think the issue is what variable I'm supposed to use to iterate through the items array?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,220 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,776 Reputation points
    2024-04-30T06:21:11.9366667+00:00

    @Mike Nanto Thanks for reaching out. I am not sure of the output format you are looking for. But here is sample liquid template I have created for your scenario.

      [
    {%- for record in items -%}
      {"id": {{record.id}} ,
       "number": {{record.number}}} {% unless forloop.last %},{% endunless -%}
    {%- endfor -%}
    ]
    

    Resultant output for provided output:

    User's image

    To test your liquid templates, you can use this playground.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.