Skip to content

Instantly share code, notes, and snippets.

@seeni-dev
Last active November 13, 2021 07:49
Show Gist options
  • Save seeni-dev/740a92a001ad665c6913d6390db78b66 to your computer and use it in GitHub Desktop.
Save seeni-dev/740a92a001ad665c6913d6390db78b66 to your computer and use it in GitHub Desktop.
SampleApp.scala
import io.circe._, io.circe.generic.semiauto._, io.circe.syntax._
val johnDoe = Person("John Doe", 24, Address(5, "Times Square Street", "New York", "12345"))
println(Person.encode(johnDoe))
val encodedText = """
{
"name" : "Fin",
"age" : 21,
"address" : {
"doorNo" : 7,
"street" : "Staten Island",
"city" : "New York",
"zipCode" : "23456"
}
}
"""
val decodedJohnDoe = Person.decode(encodedText)
println(decodedJohnDoe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment