Skip to content

Instantly share code, notes, and snippets.

View blak-code-tech's full-sized avatar
🎯
Focusing

Daniel Otoo blak-code-tech

🎯
Focusing
View GitHub Profile
@dannypule
dannypule / json_to_csv.js
Created February 8, 2017 18:40
Export JSON to CSV file using Javascript
function convertToCSV(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]) {
if (line != '') line += ','
line += array[i][index];