Parsing json array in liquid template
I have been facing issues with the looping to iterate through the JSON array and create XMLHere is my sample -
{ "userPriority": "Medium", "fileAttachment": [{ "fileExt": "", "fileName": "", "fileBase64": "" }] }, "sharedList": { "contact": [ { "userId": "pokuri" }, { "userId": "sam," } ] } } Here is the policy -
<SharedList>
{% for contact in body.Document.SharedList.Contact %}
<Contact>{% if contact.userId %}
<UserId>{{ contact.UserId }}</UserId>
{% else %}
<UserId>Empty</UserId>
{% endif %}
</Contact>
{% endfor %}
</SharedList>
Here is my liquid template transformation for Azure APIM policy. However, in the trace, I see that the policy below does not read array attributes.
Please let me know if I have to correct anything in the policy.
Thanks
Siva Pokuri.