Last active
August 29, 2015 14:23
-
-
Save monkeygroover/0e4e2f5648b91c3bc6c4 to your computer and use it in GitHub Desktop.
shapelessspray
This file contains hidden or 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 org.ensime.json.FamilyFormats | |
import spray.json._ | |
object MainApp extends App { | |
case class Foo(blah: String, blah2: Option[String]) | |
case class Bar(boo: List[Foo]) | |
val wat = Bar(Foo("dfsdf", Some("dsfd")) :: Foo("feefef", None) :: Nil) | |
import FamilyFormats._ | |
val jsonWat = wat.toJson | |
println(jsonWat.prettyPrint) | |
val backAgain = jsonWat.convertTo[Bar] | |
println(backAgain) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires: https://github.com/ensime/ensime-server/tree/master/spray-json-shapeless/src/main/scala/org/ensime/json
output:
{
"boo": [{
"blah": "dfsdf",
"blah2": "dsfd"
}, {
"blah": "feefef"
}]
}
Bar(List(Foo(dfsdf,Some(dsfd)), Foo(feefef,None)))