If I have a list of users say [\"Sam\", \"Bob\", \"Joe\"], I want to do something where I can output in my jinja template file:
users
[\"Sam\", \"Bob\", \"Joe\"]
{%
You want your if check to be:
if
{% if not loop.last %} , {% endif %}
Note that you can also shorten the code by using If Expression:
{{ ", " if not loop.last }}