JSONtoCSV
Converts an array of objects to a comma-separated values (CSV) string that contains only the columns
specified.
- Use
Array.prototype.join(delimiter)
to combine all the names incolumns
to create the first row. - Use
Array.prototype.map()
andArray.prototype.reduce()
to create a row for each object, substituting non-existent values with empty strings and only mapping values incolumns
. - Use
Array.prototype.join('\n')
to combine all rows into a string. - Omit the third argument,
delimiter
, to use a default delimiter of,
.