I’m using the single-send-api with a for loop but the for loop is not working as expected. I used the example in the documentation and added an additional custom property to show that the single custom properties at the main level works, but the array property using a for loop is not working.
Note: when I render the same email in python using jinja2 the for loop works as expected.
In the design preview the For loop {{ variables }} do not show up in the preview
Here is the acutal email received that was sent through the api, the property outisde the loop works but not the array for loop properties:
Here is the template (I used the example in the documentation and it works fine in python rendered usinng Jinja2):
<!--
templateType: email
isAvailableForNewContent: true
-->
<!doctype html>
<html>
<head>
<title>test</title>
</head>
<body>
<p>
Thanks for your recent purchase! Here are the details of the items you'll be receiving:
</p>
<p>
Testing a custom value outside the for loop: {{ custom.test_key }}
</p>
<ul>
{% for item in custom.exampleArray %}
<li>First key: {{ item.firstKey }}, Second key: {{item.secondKey}}</li>
{% endfor %}
</ul>
<p id="footer">
{{ site_settings.company_name }}
{{ site_settings.company_street_address_1 }}
{{ site_settings.company_street_address_2 }}
{{ site_settings.company_city }}
{{ site_settings.company_state }}
{{ site_settings.company_zip }}
{{ site_settings.company_country }}
<br/>
You received this email because you are subscribed to {{ subscription_name }} from {{ site_settings.company_name }}.
<br/>
<a class="hubspot-mergetag" data-unsubscribe="true" href="{{ unsubscribe_link }}">Update your email preferences</a> to choose the types of emails you receive.
<br/>
<a class="hubspot-mergetag" data-unsubscribe="true" href="{{ unsubscribe_link_all }}">Unsubscribe from all future emails.</a>
</p>
</body>
</html>
Here is the json data
data = {
"emailId": 168429014623,
"message": {
"to": "test@test.com",
},
"customProperties": {
'test_key':'test_value',
"exampleArray": [
{"firstKey": "someValue", "secondKey": "anotherValue"},
{"firstKey": "value1", "secondKey": "value2"}
]
}
}

