json2csv icon indicating copy to clipboard operation
json2csv copied to clipboard

Not preserve keys order

Open rdxmaor opened this issue 6 years ago • 4 comments

It seems like the tool can't preserve JSON keys order.

rdxmaor avatar Jun 11 '19 10:06 rdxmaor

was searching for that as well. any updates on this? btw thanks for the tool!

squillace91 avatar Sep 10 '20 22:09 squillace91

It's hard to preserve keys order because of Golang constraint. Golang's map structure type is non-ordered.

yukithm avatar Sep 11 '20 06:09 yukithm

I found a helpful package called orderedset it's helped me a lot with this problem, maybe you could see the source and apply the same logic here.

EDIT And another called orderedmap who provides json encoding

mirusky avatar Oct 13 '20 02:10 mirusky

See also my own package github.com/dolmen-go/jsonmap which provides an ordered map for JSON.

dolmen avatar Mar 11 '21 12:03 dolmen