express-csv icon indicating copy to clipboard operation
express-csv copied to clipboard

Exporting array of objects, some rows have columns in a different order...

Open kimptoc opened this issue 11 years ago • 1 comments

Hi,

Many thanks for this package - very useful.

I am using it to convert an array of objects, most come out ok, columns in the same order, but a few come out with the columns jumbled up - relative to the rest.

Looking at the code, it just iterates over the properties to convert it into an array.

Any plans to try to make it more consistent?

Perhaps look at the first object and then use that to determine the fields to use for the others. Although that assumes that they are all the same...

Cheers, Chris

kimptoc avatar Mar 27 '14 21:03 kimptoc

I have implemented it in my fork (which is forked from https://github.com/jczaplew/csv-express to include headers)

https://github.com/zevero/csv-express

zevero avatar May 24 '16 06:05 zevero