# jinja json template adds an extra comma breaking json structure

**URL:** <https://forum.ansible.com/t/jinja-json-template-adds-an-extra-comma-breaking-json-structure/15927>\
**Category:** Ansible Project\
**Created:** [August 13, 2014, 6:05am UTC](https://forum.ansible.com/t/jinja-json-template-adds-an-extra-comma-breaking-json-structure/15927 "2014-08-13T06:05:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [August 13, 2014, 6:05am UTC](https://forum.ansible.com/t/jinja-json-template-adds-an-extra-comma-breaking-json-structure/15927/1 "2014-08-13T06:05:47Z")

</div>

How can I stop the look inside the jinja template so when it gets the the last item it doesn’t add a comma at the end breaking the json format. I can clearly the very last command on the 5th to last line is whats wrong but I can’t come up with a solution to this problem. Thanks!

This is my jinja template:

`{ "checks": { {% if elite_receipt_active_domains is defined %} {% for check in elite_receipt_active_domains %} "{{ check.domain }}-cert_check": { "command": "/etc/sensu/plugins/check-https-cert.rb --url https://{{ check.domain }} --warning 30 --critical 10", "handlers": [{{ check.handlers | to_nice_json }}], "interval": {{ ssl_cert_check_interval }}, "standalone": true, "subscribers": ["test"] }, {% endfor %} {% for check in elite_receipt_active_domains %} "{{ check.domain }}-http_redirect_check": { "command": "/etc/sensu/plugins/check-http.rb --url https://{{ check.domain }} -s false --response-code 301 --redirect-to https://{{ check.domain }} ", "handlers": [{{ check.handlers | to_nice_json }}], "interval": {{ http_redirect_checK_interval }}, "standalone": true }, {% endfor %} {% for check in elite_receipt_active_domains %} "{{ check.domain }}-https_check": { "command": "/etc/sensu/plugins/check-http.rb --url https://{{ check.domain }} -s true ", "handlers": [{{ check.handlers | to_nice_json }}], "interval": {{ http_check_interval }}, "standalone": true }, {% endfor %} {% endif %} } }`
