ryu1kn / csv-writer

Convert objects/arrays into a CSV string or write them into a CSV file
https://www.npmjs.com/package/csv-writer
MIT License
246 stars 39 forks source link

Converting nested objects/arrays into separate columns #20

Closed vikaskyadav closed 5 years ago

vikaskyadav commented 5 years ago

I'm facing difficulty converting nested arrays/objects to separate columns in CSV. Can't there be any mode in which the library accepts the response and automatically picks up nested objects/arrays in separate columns with headers being the key values?

ryu1kn commented 5 years ago

I'm not too sure if I want to extend the library to cover that. I'll think about it.

Meanwhile, you can use something like Lodash's _.get to convert into a flat object

ryu1kn commented 5 years ago

Hi @vikaskyadav, I think I wanna keep CSV Writer small and focused, and I feel this should be done outside of this library; so I'm closing this for now. I may reconsider this if we have more people believe this should be provided by CSV writer. Thanks for the suggestion anyway!