Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to preserve key order relying on toEncoding #28

Open
fizruk opened this issue Mar 16, 2018 · 6 comments
Open

Option to preserve key order relying on toEncoding #28

fizruk opened this issue Mar 16, 2018 · 6 comments

Comments

@fizruk
Copy link

fizruk commented Mar 16, 2018

Right now the keys are always resorted when using encodePretty.
However, sometimes it is desired to preserve the key order from toEncoding.

See GetShopTV/swagger2#98 for a possible use case.

@eltix
Copy link

eltix commented Sep 26, 2019

This would definitely a plus. Right now there are many cases where we cannot use encodePretty (and use encode from Data.Aeson instead) because of this.

@guibou
Copy link

guibou commented Oct 30, 2021

I'm interested by this issue.

Unfortunately, toEncoding yields a Builder which does not contain any structure anymore, so it is not possible to format it again, except by converting it back to Value with decode, but the order will be lost.

@martijnbastiaan
Copy link
Collaborator

IMO this is a pretty serious issue that conflicts with this library's core mission:

The library provides a single function encodePretty. It is a drop-in replacement for aeson's encode function, producing JSON-ByteStrings for human readers.

@theophile-scrive
Copy link

@informatikr @DougBurke Would you be open to a PR that fixes this behaviour?

@martijnbastiaan
Copy link
Collaborator

@theophile-scrive I've taken over maintainership for this package. I'd definitely be interested!

@theophile-scrive
Copy link

@martijnbastiaan Very well. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants