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

Please add option to sort keys #12

Open
hawkeyej opened this issue Apr 1, 2016 · 2 comments
Open

Please add option to sort keys #12

hawkeyej opened this issue Apr 1, 2016 · 2 comments

Comments

@hawkeyej
Copy link

hawkeyej commented Apr 1, 2016

Since jpterm is a tool for humans, please add an option to sort the keys.

@gsamuelhays
Copy link

@hawkeyej could you provide an example of what you mean? jpterm supports the sort() function.

@interspoerri
Copy link

I think he means the equivalent of jq's -S:

Output the fields of each object with the keys in sorted order.

E.g. echo '[{"b":2, "a":3}]' | jp.py -S '[0]'
Would generate: { "a": 3, "b": 2 }

Alternatively, is there a way to do this with existing tools? E.g. [0].{sort(keys([0]))}

This would be useful for running unix diff on the output of two different jmespath invocations.

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

No branches or pull requests

4 participants