Created
July 26, 2010 18:46
-
-
Save debasishg/491021 to your computer and use it in GitHub Desktop.
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
case class Holder(item: List[String]) | |
implicit val HolderFormat: Format[Holder] = wrap[Holder, List[String]]("item")(_.item, Holder) | |
// instantiate the case class | |
val n = Holder(List("debasish ghosh", "jonas boner", "stephan schmidt")) | |
// js is a JsValue | |
val js = tojson(n) | |
// convert js to string and print | |
println(dispatch.json.JsValue.toJson(js)) | |
// de-serailzing using fromjson will give back the Holder n | |
fromjson[Holder](tojson(n)) should equal(n) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment