Created
April 14, 2018 16:40
-
-
Save kevinmeredith/80f8b66d11dc15d32a06ea3e67f1cc10 to your computer and use it in GitHub Desktop.
Circe Enum Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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