Skip to content

Instantly share code, notes, and snippets.

@adamw
Created July 16, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamw/a1fb9bef430b330aa7daa1c34890d601 to your computer and use it in GitHub Desktop.
Save adamw/a1fb9bef430b330aa7daa1c34890d601 to your computer and use it in GitHub Desktop.
import com.softwaremill.tagging.@@
import io.circe.generic.AutoDerivation
import io.circe.java8.time.{JavaTimeDecoders, JavaTimeEncoders}
import io.circe.{Decoder, Encoder, Printer}
object Json extends AutoDerivation with JavaTimeDecoders with JavaTimeEncoders {
val noNullsPrinter: Printer = Printer.noSpaces.copy(dropNullValues = true)
implicit def taggedStringEncoder[U]: Encoder[String @@ U] =
Encoder.encodeString.asInstanceOf[Encoder[String @@ U]]
implicit def taggedStringDecoder[U]: Decoder[String @@ U] =
Decoder.decodeString.asInstanceOf[Decoder[String @@ U]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment