# How to render boolean true in j2 file?

**URL:** <https://forum.ansible.com/t/how-to-render-boolean-true-in-j2-file/35976>\
**Category:** Ansible Project\
**Created:** [November 8, 2021, 2:21pm UTC](https://forum.ansible.com/t/how-to-render-boolean-true-in-j2-file/35976 "2021-11-08T14:21:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_Young](https://avatars.discourse-cdn.com/v4/letter/n/a3d4f5/32.png) [@Neil\_Young](https://forum.ansible.com/u/Neil_Young)\
**Post date:** [November 8, 2021, 2:21pm UTC](https://forum.ansible.com/t/how-to-render-boolean-true-in-j2-file/35976/1 "2021-11-08T14:21:54Z")

</div>

I’m not entirely sure if this is a YAML problem or an Ansible thing.

Trying to render a configuration json file from a j2 template.

Template.j2

{  
“test”: {{ boolean\_test }}  
}

default.yml:

boolean\_test: true

Result:

{  
“test”: True  
}

The result makes my node app complain (invalid json)

How to render

{  
“test”: true  
}

?

---

<div class="post-metadata">

**Author:** ![Neil\_Young](https://avatars.discourse-cdn.com/v4/letter/n/a3d4f5/32.png) [@Neil\_Young](https://forum.ansible.com/u/Neil_Young)\
**Post date:** [November 8, 2021, 2:33pm UTC](https://forum.ansible.com/t/how-to-render-boolean-true-in-j2-file/35976/2 "2021-11-08T14:33:02Z")

</div>

Found it:

default.yml:

boolean\_test: !!str true
