# json query question

**URL:** <https://forum.ansible.com/t/json-query-question/35937>\
**Category:** Ansible Project\
**Created:** [October 28, 2021, 7:28pm UTC](https://forum.ansible.com/t/json-query-question/35937 "2021-10-28T19:28:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tommy\_Tyrell](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@Tommy\_Tyrell](https://forum.ansible.com/u/Tommy_Tyrell)\
**Post date:** [October 28, 2021, 7:28pm UTC](https://forum.ansible.com/t/json-query-question/35937/1 "2021-10-28T19:28:52Z")

</div>

Forgive the noob question. I am new to Ansible. I am attempting to filter the json results of my playbook to only get specific information. Looking at the Ansible documentation, it is possible using community.general.json\_query. It appears to work on some of the data but I am unable to come up with the correct syntax for what I need. Below is some sample output along with a snippet of my code. Please help me with the correct syntax. Thanks!

I am trying to get only the value of “author”.

My code snippet:

- name:

ansible.builtin.debug:  
var: item  
loop: “{{ results | community.general.json\_query(‘json.body[\*].book\_details’) }}”

Sample json output:

“ansible\_loop\_var”: “item”,  
“item”: {  
“asterisk”: 0,  
“bestsellers\_date”: “2016-12-31”,  
“book\_details”: [  
{  
“age\_group”: “”,  
“amazon\_product\_url”: “[https://www.amazon.com/Undoing-Project-Friendship-Changed-Minds-ebook/dp/B01GI6S7EK?tag=NYTBSREV-20](https://www.amazon.com/Undoing-Project-Friendship-Changed-Minds-ebook/dp/B01GI6S7EK?tag=NYTBSREV-20)”,  
“author”: “Michael Lewis”,  
“book\_image”: “[https://storage.googleapis.com/du-prd/books/images/9780393254600.jpg](https://storage.googleapis.com/du-prd/books/images/9780393254600.jpg)”,  
“book\_uri”: “nyt://book/5ecd45ad-8552-5f5f-8d7b-6ab0bb3bf624”,  
“contributor”: “by Michael Lewis”,  
“contributor\_note”: “”,  
“description”: “How the psychologists Daniel Kahneman and Amos Tversky upended assumptions about the decision-making process and invented the field of behavioral economics. Their close friendship and porous collaboration style became one of the greatest partnerships in the history of science.”,  
“price”: “0.00”,  
“primary\_isbn10”: “0393254593”,  
“primary\_isbn13”: “9780393254594”,  
“publisher”: “Norton”,  
“title”: “THE UNDOING PROJECT”  
}  
],
