Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the complex object example, what's the usecase for turning that nested object into a multi-column CSV? I guess the overarching question is, why turn a single object at all into a CSV? It's just as machine/human readable as the JSON version of it, and there's no particular benefit in using either structure as it's not data meant to be processed in bulk.

The complex array usecase is where an opinionated-type of conversion tool is particularly needed, but I wonder why it behaves like this:

   name: 'Robert',
   lastname: 'Miller',
   family: null,
   location: [1231,3214,4214]

lastname,name,family.type,family.name,nickname,location Miller,Robert,,,,1231,3214,4214

Why not have `location_1, location_2, location_3`, instead of having a single location column? The latter implementation makes the data difficult to quickly use in a program (like a spreadsheet).



This only happends if its a simple array, but if you have something like

   name: 'Robert',
   lastname: 'Miller',
   family: null,
   location: [{city: 'A'}, {city: 'B'}]
you would get 2 csv lines one with location.city A and other with B


To answer your first question: A whole bunch of non progammer types use csv for everything. SAS and SPSS rule everything around them and they do input from csv. Source: I used to make good money doing the turn x to csv for academics all over.

As to the last, I got nothing. It's how I would have rolled.


Hey, why are you picking on me? :)


It's possible to implement the `location_1, location_2, location_3` as a optional feature.

But i am not sure what name to use for this option.


Maybe some variant on "Extract array elements to separate columns"? or did you mean what to name the command line option? Maybe a "--list-treatment=" option, which can be "concat" or "separate"?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: