# using JSON files vs YAML for host vars

**URL:** <https://forum.ansible.com/t/using-json-files-vs-yaml-for-host-vars/21832>\
**Category:** Ansible Project\
**Created:** [June 22, 2016, 12:25pm UTC](https://forum.ansible.com/t/using-json-files-vs-yaml-for-host-vars/21832 "2016-06-22T12:25:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Marquez](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@Eric\_Marquez](https://forum.ansible.com/u/Eric_Marquez)\
**Post date:** [June 22, 2016, 12:25pm UTC](https://forum.ansible.com/t/using-json-files-vs-yaml-for-host-vars/21832/1 "2016-06-22T12:25:23Z")

</div>

Is it possible to use a JSON file instead of writing the file as YAML? Will Ansible use the two interchangeable or do you need to provide an additional setting when it’s called from Ansible-play?

In my Host Vars file could I have something like this?

{

“ETHERNET\_TRUNK”: {

“PORT”: [

“1/1”

]

}

}

Vs. making the file support YAML instead?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 22, 2016, 12:38pm UTC](https://forum.ansible.com/t/using-json-files-vs-yaml-for-host-vars/21832/2 "2016-06-22T12:38:01Z")

</div>

JSON is a subset of YAML, so the YAML parser will be able to understand it.

---

<div class="post-metadata">

**Author:** ![Eric\_Marquez](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@Eric\_Marquez](https://forum.ansible.com/u/Eric_Marquez)\
**Post date:** [June 22, 2016, 1:42pm UTC](https://forum.ansible.com/t/using-json-files-vs-yaml-for-host-vars/21832/3 "2016-06-22T13:42:42Z")

</div>

Great, Thanks!
