リクエストからJSON文字列を読み込み、Play/ScalaベースのRESTアプリケーションでケースクラスに変換しようとしています。 私のコードはJSON/BigInt Jsonデシリアライザ(再生/スカラ)
implicit val memberRead: Reads[MemberInfo] = (
(JsPath \ "memberId").readNullable[BigInt] and
(JsPath \ "firstName").read[String] and
(JsPath \ "lastName").read[String] and
(JsPath \ "janrainUUID").readNullable[String] and
(JsPath \ "phones").read[Seq[MemberPhone]] and
(JsPath \ "address").read[Seq[MemberAddress]]
)(MemberInfo.apply _)
implicit val addressRead: Reads[MemberAddress] = (
(JsPath \ "addressId").readNullable[BigInt] and
(JsPath \ "addressType").read[String] and
(JsPath \ "address").read[String] and
(JsPath \ "memberId").read[BigInt]
)(MemberAddress.apply _)
implicit val phoneRead: Reads[MemberPhone] = (
(JsPath \ "phoneId").readNullable[BigInt] and
(JsPath \ "phoneNumber").read[String] and
(JsPath \ "phoneType").read[String] and
(JsPath \ "primaryInd").read[String] and
(JsPath \ "memberId").read[BigInt]
)(MemberPhone.apply _)
...何かのようですが、私は(phoneReadでaddressReadとphoneidなどでmemberRead、あるAddressId内のすべての3 readNullable [BigIntの]、MEMBERIDのために)いくつかのコンパイルエラーを取得しています。エラーが...
No Json deserializer found for type BigInt. Try to implement an implicit Reads or Format for this type.
私の場合クラスがjanrainUUIDため、このようないくつかの...
case class MemberInfo(memberId : Option[BigInt],firstName : String, lastName : String,janrainUUID :Option[String] , phones : Seq[MemberPhone],address : Seq[MemberAddress])
case class MemberAddress(addressId:Option[BigInt],addressType:String,address:String,memberId:BigInt)
case class MemberPhone(phoneId : Option[BigInt], phoneNumber:String,phoneType:String,primaryInd:String,memberId:BigInt)
ですされています。オプション[文字列]私は、コンパイル・エラーを取得していないのですが、BigInt型のために、私は取得しています"No JsonデシリアライザがBigInt型で見つかりませんでした"
BigIntでこのエラーが発生する理由は何ですか?実際にはそれらはDB操作を行うときのPK値なので、要求に応じることはありません。ジャージの@ignoreアノテーションのような演劇/スカラでそれを表現する方法はありますか?
任意の助けが理解されるであろう、おかげでたくさん...
使用しているプレイバージョンを知ることはできますか? – Learner
https://github.com/playframework/play-json/pull/122 – cchantep