jackson-module-scala
jackson-module-scala copied to clipboard
Serializer for Scala Map converts to Java Map - avoid this conversion
- https://github.com/FasterXML/jackson-module-scala/issues/468 recently fix for Iterables and Iterators
- the existing Scala Map code converts to a Java Map so it can reuse the pre-existing Java serializer
This task will probably require copying https://github.com/FasterXML/jackson-databind/blob/166ce08b96465fc2a2a9ae385919c38ac3a3b6b4/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java (all 1000+ lines) and writing a version that handles Scala Maps natively (ie without converting the Scala map to a Java Map). After getting that working, we would need a big new suite of tests that test serializing maps with a large variety of ObjectMapper configs.
We get away (to an extent) without having a big barrage of Map serializaton tests because we reuse the Java support (at the moment).
My advice to anyone is to avoid using Maps. They put too complexity on the JSON serialization framework. Use Collections of strongly typed data.
I'll close this for now. I suspect that the (probably small) potential perf gains are more than offset by the cost of maintaining a large custom Scala Map serializer. The Java Map serializer is pretty complicated (in jackson-databind).