Fork me on GitHub
#reitit
<
2022-12-25
>
Ben Sless07:12:11

This is more jsonista related, but does anyone know how to write a custom map serializer for Jackson?

Ben Sless10:12:38

I'm not sure going this way would be most performant:

(doseq [e es] (.writeRawValue gen (.writeValueAsString mapper e)))
The map serializer does lookup for the correct value type

1
Ben Sless11:12:17

Things I've tried: • Extending StdSerializer • Extending MapSerializer (has a ton of constructor arguments I couldn't get right) • Use SerializationModifier for MapSerializer, didn't get that right, either

Ben Sless11:12:58

This all starts with this code path which serialization of maps ends up on https://github.com/FasterXML/jackson-databind/blob/2.15/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java#L774 I want to use kvreduce instead