0

Im using msgpack java with jackson serialization and its scala type conversions in a simple project. The msgpack is originally serialized in python and looks like price��5.0000� When i try to serialize in java or scala i get the following error

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of double out of VALUE_EMBEDDED_OBJECT token

This happens for any decimal type. Is there some trick to serializing decimal values in scala with msgpack?

These are the versions im using.

"org.msgpack" % "msgpack-core" % "0.8.13",
"org.msgpack" % "jackson-dataformat-msgpack" % "0.8.13",

"com.fasterxml.jackson.core" % "jackson-core" % "2.9.1",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.1",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.1",
"com.fasterxml.jackson.datatype" % "jackson-datatype-guava" % "2.9.1",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.1",
Sam Merry
  • 13
  • 7

1 Answers1

0

You can get around this by writing a custom serializer for float values that also supports scientific notation strings from python using BigFloat. Returning new BigDecimal(<your string>) fixes this specific problem.

Sam Merry
  • 13
  • 7