【发布时间】:2016-07-05 18:32:28
【问题描述】:
我使用 jq 漂亮地打印非常复杂的 json。然后使用 diff 比较不同的版本。有没有办法让 jq 按字母顺序排列输出?
更快的 xml 对象映射器对此提供支持
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);
亲切的问候
安迪
【问题讨论】: