-
Notifications
You must be signed in to change notification settings - Fork 33
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
Sort keys of objects #137
Comments
Hi @jameschenjav and thanks for the positive feedback! Basically Nobody complained about it so far... and I was the one introducing this (no issue). So basically, we have two options:
|
Hi @yamafaktory Thanks for your response. It makes sense to keep original order by default. As it will be a breaking change, if someone had already built test-cases without proper comparison, the tests will break. So imo better to have a new flag. |
A follow-up on this topic. The current issue is that, as already mentioned, Still trying to investigate a bit. Let's keep this open for now. |
I've been investigating this a bit myself, and as you say, there is no way to conditionally toggle a crate feature, since features get applied at build-time. However, I think Cargo can handle compiling two different versions of serde_json - one with the I personally think the best way is to put optional sorting behind a feature flag in jql. Feels less bloated. Though perhaps we can even hide the sort-flag double-dependency shenanigans behind a feature-flag as well? |
@kmaasrud I thought about that too but that would mean two different versions since this is a binary (this can works fine for a the library part of course). Folks that will install it will still get the default one. |
@yamafaktory, yes it seems like my idea is not possible. The thought was to have two versions of serde_json compiled into the binary - one with the I say document the sorting behavior and then people can install their preferred version of jql with |
That's an option indeed. My main concern is that it feels a bit awkward and might be even more weird regarding the packages distributed on different OS (not maintained here). |
Let's maybe keep this open for a bit longer and see if some trick might help fixing that. |
Sounds like a good idea 👍 |
I guess we can 2 have intermediate crates, one with serde json dep and other with serde json (preserved order) dep. |
The sorting flag from
jq
is very helpful when dealing with JSON APIs.There is an example:
Can we have this feature as well? Also, as a new rustacean I really appreciate your work. I had some issue to link
lib-jq
on my Mac, so this crate will save me a lot of time.The text was updated successfully, but these errors were encountered: