I use jq to print very complex json. then use diff to compare another version. Is there a way I can get jq to sort the output alphabetically with keys?
XML accelerators 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);
Yours faithfully
Andy
source share