This returns the keys from an object.
{% foreach key in { a: 1, b: 2, c: 3, d: 4 }|keys %}
{{key}} <br />
{% endforeach %}
Result
a
b
c
d
A separator is also possible to provide.
{% foreach key in { a: 1, b: 2, c: 3, d: 4 }|keys %}
{{key}}, <br />
{% endforeach %}
Result
a,
b,
c,
d,