All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.malliina.json.PrimitiveFormats.scala Maven / Gradle / Ivy

The newest version!
package com.malliina.json

import play.api.libs.json.Json.toJson
import play.api.libs.json._

import scala.concurrent.duration.{Duration, DurationLong}

object PrimitiveFormats {
  implicit val durationFormat: Format[Duration] = Format[Duration](
    Reads(_.validate[Long].map(_.seconds)),
    Writes(d => toJson(d.toSeconds))
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy