Hi Racke

Below is the json output

interfaces_status_facts:
      Te1/0/37:
        data:
          duplex: auto
          interface: Te1/0/37
          name: '                  '
          speed: auto
          status: notconnect
          type: ' 100/1000/2.5G/5G/10GBaseTX'
          vlan: '1'
      Te1/0/38:
        data:
          duplex: auto
          interface: Te1/0/38
          name: interface configur
          speed: auto
          status: notconnect
          type: ' 100/1000/2.5G/5G/10GBaseTX'
          vlan: '25'


On Wednesday, November 20, 2019 at 9:45:03 PM UTC+5:30, Stefan Hornburg 
(Racke) wrote:
>
> On 11/20/19 4:43 PM, rajthecomputerguy wrote: 
> > Hi Racke, 
> > 
> > I parsed the cisco command "show interface status" and  converted to 
> json , now I want to convert it to csv.  
> > 
> >     - name: Write interfaces_status_facts to 
> > 
> '/var/lib/awx/projects/test-sk/show_interfaces_status_facts-[inventory_hostname].json'
>  
>
> >       copy: 
> >         content: "{{ interfaces_status_facts | to_nice_json }}"        
> >         dest: "/var/lib/awx/projects/test-sk/interfaces_status_facts-{{ 
> inventory_hostname }}.json" 
> > 
>
> So how does the resulting JSON look like? I think it would be easier to 
> convert the "interfaces_status_facts" straight 
> away to CSV. 
>
> Regards 
>          Racke 
>
> > 
> > 
> > 
> > 
> > On Wednesday, November 20, 2019 at 4:40:51 PM UTC+5:30, Stefan Hornburg 
> (Racke) wrote: 
> > 
> >     On 11/20/19 11:30 AM, rajthecomputerguy wrote: 
> >     > Hi Team, 
> >     > 
> >     > Anybody knows how to convert json to csv in ansible? 
> >     > 
> >     > Thanks, 
> >     > Pushparaj 
> >     > 
> > 
> >     What's your use case? I suppose you know you can't convert JSON with 
> a nested structure to CSV? 
> > 
> >     Regards 
> >             Racke 
> > 
> >     > -- 
> >     > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> >     > To unsubscribe from this group and stop receiving emails from it, 
> send an email to 
> >     > [email protected] <javascript:> <mailto:
> [email protected] <javascript:> 
> <javascript:>>. 
> >     > To view this discussion on the web visit 
> >     > 
> https://groups.google.com/d/msgid/ansible-project/6f4a23c6-12ae-4736-abd3-972df733ce6e%40googlegroups.com
>  
> >     <
> https://groups.google.com/d/msgid/ansible-project/6f4a23c6-12ae-4736-abd3-972df733ce6e%40googlegroups.com>
>  
>
> >     > 
> >     <
> https://groups.google.com/d/msgid/ansible-project/6f4a23c6-12ae-4736-abd3-972df733ce6e%40googlegroups.com?utm_medium=email&utm_source=footer
>  
> >     <
> https://groups.google.com/d/msgid/ansible-project/6f4a23c6-12ae-4736-abd3-972df733ce6e%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>  
>
> > 
> > 
> > 
> >     -- 
> >     Ecommerce and Linux consulting + Perl and web application 
> programming. 
> >     Debian and Sympa administration. Provisioning with Ansible. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to 
> > [email protected] <javascript:> <mailto:
> [email protected] <javascript:>>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/aee026d0-a792-464b-be95-c46426c81d88%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/aee026d0-a792-464b-be95-c46426c81d88%40googlegroups.com?utm_medium=email&utm_source=footer>.
>  
>
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming. 
> Debian and Sympa administration. Provisioning with Ansible. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2ade7c79-b6ef-4951-8fc3-440c7f6ad9cd%40googlegroups.com.

Reply via email to