# CSV to JSON

**URL:** <https://forum.ansible.com/t/csv-to-json/32986>\
**Category:** Ansible Project\
**Created:** [May 20, 2020, 6:07pm UTC](https://forum.ansible.com/t/csv-to-json/32986 "2020-05-20T18:07:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shyam.rpms](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@shyam.rpms](https://forum.ansible.com/u/shyam.rpms)\
**Post date:** [May 20, 2020, 6:07pm UTC](https://forum.ansible.com/t/csv-to-json/32986/1 "2020-05-20T18:07:50Z")

</div>

Hi,

Is it possible to convert CSV file to JSON format using Ansible modules, I have searched for the modules have’t found. Or else do we need to use any scripting language to achieve this powershell or python ?

Thank you,  
Shyam.

---

<div class="post-metadata">

**Author:** ![Antony\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Antony\_Stone](https://forum.ansible.com/u/Antony_Stone)\
**Post date:** [May 20, 2020, 7:06pm UTC](https://forum.ansible.com/t/csv-to-json/32986/2 "2020-05-20T19:06:00Z")

</div>

> Hi,
> 
> Is it possible to convert CSV file to JSON format using Ansible modules,

Thsi really sounds like the wrong tool for the job, to me.

> Or else do we need to use any scripting language to achieve this powershell  
> or python ?

I've no idea about powershell (but I don't think it would be easy).

Python could do it, perl could do it, and you might want to investigate  
telegraf.

Regards,

Antony.

---

<div class="post-metadata">

**Author:** ![Dominik\_Bessler](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@Dominik\_Bessler](https://forum.ansible.com/u/Dominik_Bessler)\
**Post date:** [May 20, 2020, 10:32pm UTC](https://forum.ansible.com/t/csv-to-json/32986/3 "2020-05-20T22:32:14Z")

</div>

Take a Look at Miller.

[https://github.com/johnkerl/miller](https://github.com/johnkerl/miller)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 21, 2020, 12:43am UTC](https://forum.ansible.com/t/csv-to-json/32986/4 "2020-05-21T00:43:30Z")

</div>

As already mentioned, Ansible is not the best tool for data conversion  
... however, the csv lookup and a template with the to\_json filter CAN  
do the work .
