Advertisement
Guest User

Untitled

a guest
Nov 9th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.30 KB | None | 0 0
  1.   implicit object DurationFormat extends JsonFormat[Duration] {
  2.     def write(obj: Duration): JsValue = JsString(obj.toString)
  3.  
  4.     def read(json: JsValue): Duration = json match {
  5.       case JsString(x) => Duration.parse(x);
  6.       case _ => deserializationError("Expected UUID as JsString")
  7.     }
  8.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement