How to convert Json to CSV or Excel?

Is there a free tool I can use to convert a json file to a csv?

  • Answer:

    Hi the below is a simple HTML-Javascript code to convert JSON to CSV. Copy the below code to a file and then run it in your browser. You will see the following screen-shot As you can see you can copy paste the JSON and specify the root of the JSON(data in this case). On clicking submit, a csv file is generated which is downloaded to your PC(with the name "download"). Just Open it in Notepad++ and their you have your csv. You may modify the below code to suit your needs. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "Page on w3.org"> <html xmlns="XHTML namespace"> <head> <title>JSON to CSV</title> <!-- <script src="scripts/json.js" type="text/javascript"></script> --> <script type="text/javascript"> function myfunction(){ var json3 = document.forms["myform"]["formarea"].value; console.log(json3); var root = document.forms["myform"]["root"].value; DownloadJSON2CSV(JSON.parse(json3)["data"]); //console.log(json3.data); //(json3.data); } function DownloadJSON2CSV(objArray) { var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; var str = ''; for (var i = 0; i < array.length; i++) { var line = ''; for (var index in array[i]) { line += array[i][index] + ','; } // Here is an example where you would wrap the values in double quotes // for (var index in array[i]) { // line += '"' + array[i][index] + '",'; // } line.slice(0,line.Length-1); str += line + '\r\n'; } window.open( "data:text/csv;charset=utf-8," + escape(str)) } </script> </head> <body> <form name="myform"> <textarea id="json_input" name="formarea" rows="30" cols="1000" spellcheck="false" placeholder="Enter JSON to convert" wrap="off" style="resize: both; width: 889px; max-width: 883px;"></textarea> <br/> Enter Above JSON's Root: <input type="text" name="root"><br> </form> <button type="button" onclick="myfunction()">Submit</button> </body> </html> Credits:http://stackoverflow.com/questions/4130849/convert-json-format-to-csv-format-for-ms-excel

Ali Mir at Quora Visit the source

Was this solution helpful to you?

Other answers

Yes, there is. For example, this seems like a reasonably functional online converter: http://www.convertcsv.com/json-to-csv.htm You don't need to write any code to get it to work, just cut and paste your JSON into the window.

Sean Leary

You can use our online http://json-csv.com.  It will convert files / text or URLs immediately.

Json Support

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.