{"roles_display": [ {% for row, outer_comma in roles_display %} [ {% for caption, rowspan, colspan, roles, row_comma in row %} { "caption": "{{ caption }}", "rowspan": {{ rowspan }}, "colspan": {{ colspan }}, "roles": [ {% for role, inner_comma in roles %} { "id": {{ role.id }}, "rolename": "{{ role.role }}", "color": "{{ role.color }}", "gradient": "{{ role.gradient }}" }{{ inner_comma }} {% endfor %} ] } {{ row_comma }} {% endfor %} ] {{ outer_comma }} {% endfor %} ]}