EindbaasExpress / handsonscala-issuemigrator

Part of the HandsOnScala Course
0 stars 0 forks source link

Strange serialization of scala Map #75

Open EindbaasExpress opened 2 years ago

EindbaasExpress commented 2 years ago

Hey,

I tried to serialize this with upicke 0.2.2, scala 2.11.2, scala.js 0.5.3 :

case class RequestMessage(requestId: String, op: String, processor: String, args: Map[String, String])
write(RequestMessage(
      "1d6d02bd-8e56-421d-9438-3bd6d0079ff1",
      "eval",
      "",
      Map(
        "gremlin" -> "g.v(x).out",
        "bindings" -> "",
        "language" -> "gremlin-groovy"
      )
    )
)

{"requestId":"1d6d02bd-8e56-421d-9438-3bd6d0079ff1","op":"eval","processor":"","args":[["gremlin","g.v(x).out"],["bindings",""],["language","gremlin-groovy"]]}

Do I need to implement unapply method for maps too in case classes? The map is serialized into some sort of list of arrays. Even if I serialize it directly it resolves to :

[["gremlin","g.v(x).out"],["bindings",""],["language","gremlin-groovy"]]

ID: 17 Original Author: l15k4