mardi 21 avril 2015

json4s (de)serialisation of Java Pojo's

I'm working on a Scala/Spray/Akka system on which we have the need to serialise and deserialise objects to json, either for the REST interface or for persisting the model.

Some of the model object are Java POJO's. We're using Json4s as serialiser, but it seems to lack support for POJO's. When serialising to json I was able to overcome this limitation by implementing a CustomSerializer. However, when deserialising Json4s tries to do it's own reflection magic resulting in a "Can't find ScalaSig for class ..." exception. The custom serialiser is never called.

I created a small project on Github to replicate this issue. Does anyone know how to solve this issue? Did anyone have a similar issue?

The issue is also reported with json4s (nr 228).

Aucun commentaire:

Enregistrer un commentaire