-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializer for Scala Map converts to Java Map - avoid this conversion #470
Comments
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. |
…g is enabled. This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
…g is enabled. This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
…g is enabled. This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in FasterXML#643 / FasterXML#470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes FasterXML#643
This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in #643 / #470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes #643
This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in #643 / #470. This commit ensures that the wrapper class is a member class in both Scala and Java. That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation. ``` {"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]} ``` Fixes #643
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). |
The text was updated successfully, but these errors were encountered: