Convert a Javascript object to a CSV file

The following will, print out a Javascript object as a string – edit as you see fit.

function csv(placesQueue) {
  var str = 'latitude,longitude\n'; // column headers
  $.each(placesQueue, function(idx, x) {
    str = str + x.geometry.location.jb + "," + x.geometry.location.kb + "\n"
  });
  return str;
}

Leave a Reply

Your email address will not be published. Required fields are marked *