json icon indicating copy to clipboard operation
json copied to clipboard

Change the result column headers

Open vstepaniuk opened this issue 4 years ago • 3 comments

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?

vstepaniuk avatar Sep 20 '20 15:09 vstepaniuk

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 [email protected] 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 .

konklone avatar Sep 20 '20 16:09 konklone

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

vstepaniuk avatar Sep 20 '20 16:09 vstepaniuk

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

vstepaniuk avatar Sep 20 '20 16:09 vstepaniuk