Scala 2.10, its impact on JSON libraries and case class validation/creation

前端 未结 3 2014
悲哀的现实
悲哀的现实 2021-02-01 17:35

In Scala 2.10 apparently we\'re getting improved reflection.

How will this impact lift-json, jerkson, sjson and friends? Furthermore, can we expect in the not too distan

3条回答
  •  隐瞒了意图╮
    2021-02-01 18:01

    Made a blog post about that, check it out at http://pedrorijo.com/blog/scala-json/

    Using case classes, and Play WS (already included in Play Framework) you case convert between json and case classes with a simple one-liner implicit

    case class User(username: String, friends: Int, enemies: Int, isAlive: Boolean)
    
    object User {
      implicit val userJsonFormat = Json.format[User]
    }
    

提交回复
热议问题