jmespath / jmespath.terminal

JMESPath exploration tool in the terminal
Other
460 stars 54 forks source link

Please add option to sort keys #12

Open hawkeyej opened 8 years ago

hawkeyej commented 8 years ago

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

gsamuelhays commented 7 years ago

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

interspoerri commented 4 years ago

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.