1

Before Play 2.1 and Scala 2.10 I used Jerkson.

Unfortunatly there is no officially released Jerkson version compatible with Scala 2.10 (yet).

I'm since using Jackson with Scala module but I don't have the desired behavior with Enumerations.

I'm trying to use Play 2.1 Reads, Writes and Format, using macro inception but it seems really painful and I need to add boilerplate stuff to my models so that the inception works:

object User extends ((String, String, Option[String], Option[String], Long, Long, Boolean, Boolean, ObjectId) => User) {
 ...
}

Then I can use implicit val userFormat: Format[User] = Json.format[User]

And I still can't dynamically serialize an Object, but just an User

I didn't look at Lift but it seems to add as much as boilerplate code as Play2.1 Json library.


I think serialization should be easy in any langage. I don't want to write custom serializers or custom parsers.

I expect the library to work with a code like that:

case class User(name: String, status: Status.Value)
val myUser = User("toto",Status.VALID)
val myMap: Map[String,Object] = ("key1" -> myUser, "key2" -> "value2")
Json.serialize(myMap)

This is what is provided in Java with Gson, Jackson and other tools like that.


So with Scala 2.10 I don't know which tool to use. And I don't understand why we would need to build custom serializers for such simple cases. Maybe Play2.1 Json is faster because it is Macro based but isn't there a possibility so that if there is no Format provided it uses reflection or something?

Do you know any tool that coold be appropriate for my usecase?

Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
  • JSON handling has been fixed in Play 2.1.1 - at least for my use case the update resolved my issues. https://plus.google.com/+playframework/posts/SQvSEne13HK – mattanja Apr 11 '13 at 21:53

2 Answers2

1

There are a multitude of forks of Jerkson ported to 2.10, but I don't know how many are releasing to Maven repositories.

Here's mine, which is mostly derived from Rand Hindi's plus a few of my own patches.

Alex Cruise
  • 7,939
  • 1
  • 27
  • 40
  • Thanks. Rand Hindi is a friend and I was aware of his repository. But we are a startup and I'd like to avoid unofficial releases because it is unofficial and it adds burden to the development process, particularly for JS devs that don't know maven and would need to clone the fort and build it locally. We don't have a Nexus or something like that yet. – Sebastien Lorber Apr 12 '13 at 08:02
  • By the way, I saw a new pull request yesterday on Jerkson for Scala 2.10 so maybe it will be integrated soon? "codahale authored 10 months ago" -> I think it may take some time :( – Sebastien Lorber Apr 12 '13 at 08:03
0

I replaced my Jerkson code by Jackson Scala Module and it works fine

Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419