Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure what you're doing, but this will go from JSON to CSV using JavaScript. This is using the <a href="http://www.json.org/js.html" rel="noreferrer">open source JSON library</a>, so just download JSON.js into the same folder you saved the code below into, and it will parse the static JSON value in <code>json3</code> into CSV and prompt you to download/open in Excel.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;JSON to CSV&lt;/title&gt; &lt;script src="scripts/json.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var json3 = { "d": "[{\"Id\":1,\"UserName\":\"Sam Smith\"},{\"Id\":2,\"UserName\":\"Fred Frankly\"},{\"Id\":1,\"UserName\":\"Zachary Zupers\"}]" } DownloadJSON2CSV(json3.d); function DownloadJSON2CSV(objArray) { var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray; var str = ''; for (var i = 0; i &lt; 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)) } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;This page does nothing....&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload