Skip to content

Instantly share code, notes, and snippets.

@rauanmayemir
Forked from jpfuentes2/json4s_ahhhh.scala
Last active August 29, 2015 14:27
Show Gist options
  • Save rauanmayemir/153f670bfc9150b7edfa to your computer and use it in GitHub Desktop.
Save rauanmayemir/153f670bfc9150b7edfa to your computer and use it in GitHub Desktop.
import org.json4s._
import org.json4s.jackson.Serialization
case class Person(name: String)
case class Alias(name: String)
case class PersonWithAliases(p: Person, aliases: List[Alias])
implicit val formats = Serialization.formats(NoTypeHints)
val personWithAliases = PersonWithAliases(Person("Jacques"), List(Alias("Jack"), Alias("Jacky")))
val jsontext = Serialization.write(personWithAliases);
val parsed = Serialization.read[PersonWithAliases](jsontext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment