Skip to content
Advertisement

How to convert JSON to CSV format and store in a variable

I have a link that opens up JSON data in the browser, but unfortunately I have no clue how to read it. Is there a way to convert this data using JavaScript in CSV format and save it in JavaScript file?

The data looks like:

JavaScript

The closest I could find was: Convert JSON format to CSV format for MS Excel

But it downloads in a CSV file, I store it in a variable, the whole converted data.

Also would like to know how to change escape characters: 'u2019' back to normal.


I tried this code:

JavaScript

But it doesn’t seem to work. Can someone please help?

Advertisement

Answer

Ok I finally got this code working:

JavaScript

Thanks alot for all the support to all the contributors.

Praney

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement