我定义了以下读取:
import org.joda.time.DateTime;
implicit val userInfoRead: Reads[UserInfo] = (
(JsPath \ "userName").readNullable[String] and
] (JsPath \ "startDate").readNullable[DateTime]
(UserInfo.apply _)
传入以下 JSON 对象:
"userInfo" : {
"userName": "joeuser",
"startDate": "2006-02-28"
}
当我验证此数据时,我收到以下错误:
(/startDate,List(ValidationError(validate.error.expected.jodadate.format,WrappedArray(yyyy-MM-dd))))))
关于我在格式中遗漏的任何建议?