# How to read the JSON output of a module from another module I am creating

**URL:** <https://forum.ansible.com/t/how-to-read-the-json-output-of-a-module-from-another-module-i-am-creating/25089>\
**Category:** Ansible Project\
**Created:** [July 26, 2017, 10:23am UTC](https://forum.ansible.com/t/how-to-read-the-json-output-of-a-module-from-another-module-i-am-creating/25089 "2017-07-26T10:23:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell\_choudhury](https://avatars.discourse-cdn.com/v4/letter/r/e99b99/32.png) [@russell\_choudhury](https://forum.ansible.com/u/russell_choudhury)\
**Post date:** [July 26, 2017, 10:23am UTC](https://forum.ansible.com/t/how-to-read-the-json-output-of-a-module-from-another-module-i-am-creating/25089/1 "2017-07-26T10:23:24Z")

</div>

I want to be able to read the output from a specific task in the module I am creating.  
To do this I am registering the output into a variable in my playbook and then sending this as a argument in my module.  
The format of the variable is json, I am reading this in my python script as a string and trying to convert to json  
this is where I am having problems. The json read as a string is not in the correct format (its in one line and has single quotes)

If there is a better way of reading the output from one module in another module I would like to hear about it.  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![russell\_choudhury](https://avatars.discourse-cdn.com/v4/letter/r/e99b99/32.png) [@russell\_choudhury](https://forum.ansible.com/u/russell_choudhury)\
**Post date:** [July 26, 2017, 11:00am UTC](https://forum.ansible.com/t/how-to-read-the-json-output-of-a-module-from-another-module-i-am-creating/25089/2 "2017-07-26T11:00:32Z")

</div>

Ahh I got it, seems like ansible auto-magically converts the json to dict so I just changed the type from ‘string’ to ‘dict’
