# Test for empty dict

**URL:** <https://forum.ansible.com/t/test-for-empty-dict/24682>\
**Category:** Ansible Project\
**Created:** [June 8, 2017, 1:21pm UTC](https://forum.ansible.com/t/test-for-empty-dict/24682 "2017-06-08T13:21:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Greenberg](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@Ed\_Greenberg](https://forum.ansible.com/u/Ed_Greenberg)\
**Post date:** [June 8, 2017, 1:21pm UTC](https://forum.ansible.com/t/test-for-empty-dict/24682/1 "2017-06-08T13:21:22Z")

</div>

I have this:

`  
TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“changed”: false,  
“msg”: {  
“changed”: false,  
“volume”: {}  
}  
}

`

I’d like to test for this condition, where volume is an empty dict.

I tried

`  
when volume == {}

`

and, of course, got an error.

Any ideas?

---

<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:** [June 8, 2017, 2:35pm UTC](https://forum.ansible.com/t/test-for-empty-dict/24682/2 "2017-06-08T14:35:18Z")

</div>

Since you have not provided the error message I need to guess, you are missing the colon after when.
