Skip to Content

How to troubleshoot Jinja script output having multiple \n when running a playbook

This article describes how to troubleshoot Jinja script output having multiple \n when running a playbook.

Scope

FortiSOAR v7.

Sample output

Jinja script output that shows multiple ‘\n’.

Jinja Script

{% set varA = 255 %}
{% set varB = 192 %}
{% set varC = 'AB' %}
{{ varC }}

Output

Jinja script output that shows multiple ‘\n’.

This is due to a syntax error in the Jinja script (missing ‘-‘).

Solution

Add ‘-‘ at the end of each ‘%’ to become ‘-%’.

Jinja Script:

{% set varA = 255 -%}
{% set varB = 192 -%}
{% set varC = 'AB' -%}
{{ varC }}

Output

Add ‘-‘ at the end of each ‘%’ to become '-%'.