Convert JSON file to CSV

  • 1 March 2018
  • 2 replies
  • 71 views

Hello,


Hope this is the right place.

Freshdesk reports gives you option to export the activities for last 24hr.


This file generate as JSON file.

I build a script that download it locally. now i need to convert it from JSON to CSV automatically.



Can someone help me with this one? 




This topic has been closed for comments

2 replies

You didn't say what platform / programming language you are using? 


Powershell has commands to do this:  


ConvertFrom-JSON

ConvertTo-CSV 


This works fine on Windows with Powershell 5.1.  

I just searched the docs for PS 6.0 which is cross-platform (Mac, Linux) and there are similar utitilites. 


https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/ConvertFrom-Json?view=powershell-6




Hi Roey


I had this issue also.

In case you haven't solved this, I used jq, which runs on windows and linux type systems.

You can use (for example) :


<your_url_call> | jq -r ".results[] | [ .id ] | @csv"


Hope this helps



Graham