Skip to content

Instantly share code, notes, and snippets.

@hhalex
Created November 22, 2019 16:18
Show Gist options
  • Save hhalex/663a0c8a1985854f201578e3dbad5e1b to your computer and use it in GitHub Desktop.
Save hhalex/663a0c8a1985854f201578e3dbad5e1b to your computer and use it in GitHub Desktop.
Declaring a decoder for semi-automatic derivation
case class CustomStructure(a: Int)
object MyDecoders {
implicit customDecoder = deriveDecoder[CustomStructure]
}
object Main {
import MyDecoders._
val decoded: CustomStructure = decode[CustomStructure]("{a:1}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment