type mismatch error when creating Reads for Play 2.1

后端 未结 1 633
庸人自扰
庸人自扰 2021-01-22 07:50

I have been playing with this for hours. I have been trying different methods of creating a read and I am just completely stumped.

I am on Play 2.1.0 and

相关标签:
1条回答
  • 2021-01-22 08:22

    This should work:

    implicit val regReads: Reads[Registration] = (__ \ "user").read(
        (__ \ "id").read[String] and
          (__ \ "username").read[String] and
          (__ \ "first_name").read[String] and
          (__ \ "last_name").read[String] and
          (__ \ "email_address").read[String] and
          (__ \ "user_avatar").read[String]
          tupled
      ) map Registration.apply _
    

    See this question for more information.

    0 讨论(0)
提交回复
热议问题