# \## Convert stdout\_lines into json format ##

**URL:** <https://forum.ansible.com/t/convert-stdout-lines-into-json-format/31708>\
**Category:** Ansible Project\
**Created:** [November 22, 2019, 1:06pm UTC](https://forum.ansible.com/t/convert-stdout-lines-into-json-format/31708 "2019-11-22T13:06:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monohar\_Krushna\_Behe](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@Monohar\_Krushna\_Behe](https://forum.ansible.com/u/Monohar_Krushna_Behe)\
**Post date:** [November 22, 2019, 1:06pm UTC](https://forum.ansible.com/t/convert-stdout-lines-into-json-format/31708/1 "2019-11-22T13:06:45Z")

</div>

Hi Team,  
Greetings of the day!!!

Is there any **module** or **plugin** available through which we can convert the **stdout\_lines** of a **win\_shell** output into **json** data.  
if it is available can you help me how to use it.

Below is my powershell command output coming in ansible result.

**“stdout\_lines”: [**  
**“”,**  
**" Id ProcessName CPU",**  
**" – ----------- —",**  
**“564 lsass 83.46875”,**  
**“876 svchost 82.484375”,**  
**“”,**  
**“”**  
**]**

Expecting output like below format:

**“stdout\_lines”:**  
**{**  
**“Id”:**  **564** \*\*,\*\*  
**“ProcessName”: “lsass”,**  
**“CPU”:**  **83.46875**  
**},**  
**{**  
**“Id”:**  **876** \*\*,\*\*  
**“ProcessName”: “svchost”,**  
**“CPU”:**  **82.484375**  
**}**

so that I can fetch the id or process names like **stdout\_lines.ProcessName**

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [November 22, 2019, 10:34pm UTC](https://forum.ansible.com/t/convert-stdout-lines-into-json-format/31708/2 "2019-11-22T22:34:38Z")

</div>

In your win\_shell command add “| ConvertTo-Json” to the end. That will pipe the output into a json string which you can then use the from\_json filter in Ansible to turn it into a dict.
