konklone / json

A free, in-browser JSON to CSV converter.
https://konklone.io/json/
Other
753 stars 211 forks source link

Change the result column headers #249

Open vstepaniuk opened 3 years ago

vstepaniuk commented 3 years ago

Would be nice to optionally change the result column headers for

[{"a":[{"b":"c"},{"b":"d"}]}]

from

a/0/b, a/1/b

to

a/b0, a/b1

or

a/b1, a/b2.

What do you think?

konklone commented 3 years ago

That would be nicer output, but it would be much harder and slower to do. During conversion, it would have to sort of "look down" into each element and check to see if any keys match and perform special logic, which is expensive. The current approach is there because it can just walk through every level of the object without caring about "nephews/nieces" it as it assembles each column header. So, it's unlikely to change.

On Sun, Sep 20, 2020, 8:09 AM vstepaniuk notifications@github.com wrote:

Would be nice to change the result column headings for

[{"a":[{"b":0},{"b":1}]}]

from

a/0/b, a/1/b

to

a/b0, a/b1

or

a/b1, a/b2.

What do you think?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/konklone/json/issues/249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABD4BT6OQ3P6S6NSUCLJDSGYLI3ANCNFSM4RTV3SHQ .

vstepaniuk commented 3 years ago

You could just post-process the column headings after the conversion is finnished

vstepaniuk commented 3 years ago

and I don't see how it makes it more difficult to process - we just need to change the headings