# What version of Ansible added the json\_query filter?

**URL:** <https://forum.ansible.com/t/what-version-of-ansible-added-the-json-query-filter/23183>\
**Category:** Ansible Project\
**Created:** [December 6, 2016, 3:33pm UTC](https://forum.ansible.com/t/what-version-of-ansible-added-the-json-query-filter/23183 "2016-12-06T15:33:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![watsonb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/watsonb/32/309_2.png) [@watsonb](https://forum.ansible.com/u/watsonb)\
**Post date:** [December 6, 2016, 3:33pm UTC](https://forum.ansible.com/t/what-version-of-ansible-added-the-json-query-filter/23183/1 "2016-12-06T15:33:59Z")

</div>

I’m currently running Ansible 2.1.0 and get an error when trying to use the json\_query filter.

Example

- name: Display filtered variable contents  
debug: var=item  
with\_items: “{{ my\_var | json\_query(‘json.[\*].percent’)}}”

I get the following Ansible error when run on remote hosts

"template error while templating string: no filter named ‘json\_query’

I know this functionality relies on jmespath, and I do have a task defined to install jmespath via pip, like so (before the debug task above):

- name: Run pip to install jmespath  
raw: pip install jmespath  
become: true  
become\_method: sudo

Thanks!

Ben

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 6, 2016, 4:06pm UTC](https://forum.ansible.com/t/what-version-of-ansible-added-the-json-query-filter/23183/2 "2016-12-06T16:06:26Z")

</div>

`json_query` was added in v2.2

---

<div class="post-metadata">

**Author:** ![watsonb](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/watsonb/32/309_2.png) [@watsonb](https://forum.ansible.com/u/watsonb)\
**Post date:** [December 6, 2016, 4:31pm UTC](https://forum.ansible.com/t/what-version-of-ansible-added-the-json-query-filter/23183/3 "2016-12-06T16:31:07Z")

</div>

Thanks!
