Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Created April 14, 2018 16:40
Show Gist options
  • Save kevinmeredith/80f8b66d11dc15d32a06ea3e67f1cc10 to your computer and use it in GitHub Desktop.
Save kevinmeredith/80f8b66d11dc15d32a06ea3e67f1cc10 to your computer and use it in GitHub Desktop.
Circe Enum Example
import $ivy.`com.beachape::enumeratum-circe:1.5.17`
import enumeratum._
sealed trait Color extends EnumEntry; case object Color extends Enum[Color] with CirceEnum[Color] {
case object Red extends Color
case object Green extends Color
case object Blue extends Color
val values = findValues
}
@ val x: Color = Color.Red
xx: Color = Red
@ x.asJson
res10: Json = JString("Red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment