On 2020-07-26T16:05:44 -0700 Tatu Saloranta <[email protected]> wrote: > > Tree model (JsonNode / ObjectNode) is meant to represent JSON content > exactly as-is, with few if > any transformations, and is handled quite differently from POJOs. > As such there is no auto-sorting feature at this point, although there > are some plans to maybe add support: > > https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-3 > > However: you should be able to convert `ObjectNode` into `Map` (or > just `Object` more generally) with > > Map<String, Object> map = mapper.treeToValue(node, Map.class); > > after which `SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS` should > work on serialization. > So 2-step processing should handle this particular case.
Hello! Does `treeToValue` handle nested ObjectNodes? I'm actually implementing JSON canonicalization [0]. In Jackson right now, serialization without indentation fulfills all of the requirements of canonicalization except for the sorting of keys on serialization. I can certainly walk the entire tree myself, but I'd prefer not to have to. :) [0]https://tools.ietf.org/id/draft-rundgren-json-canonicalization-scheme-00.html -- Mark Raynsford | https://www.io7m.com -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/20200727081532.05f4341c%40sunflower.int.arc7.info.
