# How to get the ouput into one json file or json output

**URL:** <https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728>\
**Category:** Ansible Project\
**Created:** [November 9, 2014, 5:34am UTC](https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728 "2014-11-09T05:34:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darup\_tek](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Darup\_tek](https://forum.ansible.com/u/Darup_tek)\
**Post date:** [November 9, 2014, 5:34am UTC](https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728/1 "2014-11-09T05:34:40Z")

</div>

I am trying to gather information about some 200 servers using the setup command.  
I would like to get the output as one json data. I could see 200 json outputs.  
How do I get all the date into one json file with 200 servers information.

Appreciate the help.

---

<div class="post-metadata">

**Author:** ![Darup\_tek](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Darup\_tek](https://forum.ansible.com/u/Darup_tek)\
**Post date:** [November 9, 2014, 6:28am UTC](https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728/2 "2014-11-09T06:28:23Z")

</div>

I managed it using the ansible.runner  
Is it the right way to do it ??

---

<div class="post-metadata">

**Author:** ![J\_Dav](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@J\_Dav](https://forum.ansible.com/u/J_Dav)\
**Post date:** [November 9, 2014, 5:26pm UTC](https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728/3 "2014-11-09T17:26:59Z")

</div>

Check this out [https://github.com/nousdefions/ansible-tricks/tree/master/save\_facts](https://github.com/nousdefions/ansible-tricks/tree/master/save_facts)

You can see that in this example I’m also uploading the JSON to S3, but you can of course fork and tweak it for your use case. There are two variations, one that makes one giant JSON file or one to make one json file per host.

Credit to James Martin for helping me out with this a while back.

---

<div class="post-metadata">

**Author:** ![Darup\_tek](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@Darup\_tek](https://forum.ansible.com/u/Darup_tek)\
**Post date:** [November 10, 2014, 10:37pm UTC](https://forum.ansible.com/t/how-to-get-the-ouput-into-one-json-file-or-json-output/16728/4 "2014-11-10T22:37:31Z")

</div>

Thanks, I wil try.
