Skip to content

Instantly share code, notes, and snippets.

@yuikns
Last active August 29, 2015 14:16
Show Gist options
  • Save yuikns/bf750b776ea1483cff21 to your computer and use it in GitHub Desktop.
Save yuikns/bf750b776ea1483cff21 to your computer and use it in GitHub Desktop.
val json = net.liftweb.json.JsonParser.parse("[{\"foo\":1,\"bar\":2},{\"foo\":3,\"bar\":4}]")
implicit val formats = net.liftweb.json.DefaultFormats
case class Info(foo:Int,bar:Int)
val m = json.extract[List[Info]]
m.foreach{x=> println(x.foo+"|"+x.bar)}
import net.liftweb.json._
import net.liftweb.json.JsonAST.JObject
import net.liftweb.json.JsonDSL._
implicit val formats = DefaultFormats.lossless
val json = JsonParser.parse("""
{
"name": "joe",
"children":[
{
"name": "Mary",
"age": 5
},
{
"name": "Mazy",
"age": 3
}
]
}
""").asInstanceOf[JObject]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment