If you're writing directly to the output, you could use a for
tag, e.g.:
{% for item in items %}{% if forloop.first == false %},{% endif %}{{ item.a }} {{ item.b }}{% endfor %}
==> "ahmed gaber,biga gaber"
But if you're trying to assign
to a variable, I don't think there's a way to do that purely in liquid because there's no filter that is the equivalent to the ruby map
function. The closest I can think of is to preprocess the list so it looks like this:
a = [{a:"ahmed", b: "gaber", c: "ahmed gaber"},
{a: "biga", b: "gaber", c: "biga gaber"}]
and then use liquid map
to pluck the "c" field from each hash:
{{ assign csv = items | map: "c" | join: ","}}
The result is: {{ csv }}
==> "ahmed gaber,biga gaber"