# Ansible playbook --extra-var with dot in json key

**URL:** <https://forum.ansible.com/t/ansible-playbook-extra-var-with-dot-in-json-key/26836>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [February 23, 2018, 11:22am UTC](https://forum.ansible.com/t/ansible-playbook-extra-var-with-dot-in-json-key/26836 "2018-02-23T11:22:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foss\_Geek](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@Foss\_Geek](https://forum.ansible.com/u/Foss_Geek)\
**Post date:** [February 23, 2018, 11:22am UTC](https://forum.ansible.com/t/ansible-playbook-extra-var-with-dot-in-json-key/26836/1 "2018-02-23T11:22:34Z")

</div>

Hi All,

I need to pass a json file to ansible-palybook command using --extra-var (like --extra-var @/tmp/test.json). I am able to reference the variable inside playbook if the json key don’t have dot character in it. But I am not able reference the key which contain dot(.) in it. This is just sample entry in JSOn file but I have many keys which contain dot(.) in key name and I can’t remove the dot char in the key name because the file coming from external system.

```auto
# cat /tmp/test.json | jq
{
  "VMware.Hardware.Version": " vmx-10",

```

```auto
  "toolname": "tomcat"

```

```auto
}

```

```auto

```

```auto
Playbook:

```

```auto

```

```auto
# cat test.yml 

```

```auto
---

```

```auto
host: myhost

```

```auto
vars:

```

```auto
  hdversion: "{{ VMware.Hardware.Version }}" # not works due to dot(.), getting VARIABLE NOT DEFINED when try to reference hdversion inside role

```

```auto
  mytoolname: "{{toolname}}" # works fine

```

```auto

```

```auto
any workaround to use hdversion: "{{ VMware.Hardware.Version }}" to get the value? 

```

```auto
Any advise or guidance would be greatly appreciated.

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 23, 2018, 11:36am UTC](https://forum.ansible.com/t/ansible-playbook-extra-var-with-dot-in-json-key/26836/2 "2018-02-23T11:36:09Z")

</div>

This should work  
&nbsp;&nbsp;&nbsp;{{ vars['VMware.Hardware.Version'] }}

---

<div class="post-metadata">

**Author:** ![Foss\_Geek](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@Foss\_Geek](https://forum.ansible.com/u/Foss_Geek)\
**Post date:** [February 23, 2018, 11:57am UTC](https://forum.ansible.com/t/ansible-playbook-extra-var-with-dot-in-json-key/26836/3 "2018-02-23T11:57:38Z")

</div>

Oh. That helps. Thank you very much.
