【发布时间】:2014-10-15 15:35:03
【问题描述】:
我定义了以下读取:
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))))))
对我在格式中遗漏的内容有什么建议吗?
【问题讨论】:
-
第一个代码位的第 5 行有一个免费的
],应该在那里吗? -
不,这是复制/粘贴错字。
-
这里是示例代码中的复制/粘贴错误,而不是程序代码中。
标签: json scala datetime playframework-json