Skip to content

Instantly share code, notes, and snippets.

@swingley
Last active Dec 21, 2016
Embed
What would you like to do?
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(e) { window.vaData = e.target.response; });
xhr.open('get', 'data/68.json');
xhr.send();
vaData = JSON.parse(vaData);
vaData.table_data.values.forEach(function(row) { row.forEach(function(d, dIndex) { if ( d.indexOf && d.indexOf(',') > -1 ) { row[dIndex] = '"' + d + '"'; } }) });
var rows = vaData.table_data.values.map(function(row) { return row.join(','); });
copy(vaData.table_data.fields.join(','));
// paste to gist
copy(rows.join('\n'));
// paste to gist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment