We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extends Serializer[T]
Option[T]
object TimestampSerializer extends Serializer[Instant] { val sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ") val instantClazz: Class[Instant] = classOf[Instant] override def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Instant] = { case (TypeInfo(`instantClazz`, _), json) => json match { case JString(s) => sdf.parse(s.replaceAll("""\+(\d\d)(?::(\d\d))""", "+$1$2")).toInstant case x => throw new MappingException("Can't convert " + x + " to Instant") } } override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = { case x: Instant => JString(x.toString) } }
This is said serializer. The case class that uses an Option[Instant] is needed. The JValue is JNull. Instead of being None it throws an exception.
None
This is fixed by adding a case JNull => null, but it was not like this before ng.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is said serializer. The case class that uses an Option[Instant] is needed. The JValue is JNull. Instead of being
None
it throws an exception.This is fixed by adding a case JNull => null, but it was not like this before ng.
The text was updated successfully, but these errors were encountered: