The following jinja will convert a one-dimensional list of objects to CSV.
{% for key in vars.list[0].keys() -%}
{{ key }}{% if not loop.last %},{% endif %}
{%- endfor %}\n{% for item in vars.list -%}
{% for value in item.values() -%}
{{ value }}{% if not loop.last %},{% endif %}
{%- endfor %}{% if not loop.last %}\n{% endif %}
{%- endfor %}
It assumes the list is set as vars.list.
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.