Reputation: 948
I use jq to pretty print very complicated json. then use diff to compare different version. Is there a way I can get jq to order the output alphabetically by keys?
faster xml object mappers have support for this
prettyPrintObjectMapper = new ObjectMapper();
prettyPrintObjectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); //turn on
prettyPrintObjectMapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
String tmp1 = prettyPrintObjectMapper.writeValueAsString(myObject);
Kind regards
Andy
Upvotes: 32
Views: 14587