Last active
August 29, 2015 14:16
-
-
Save yuikns/bf750b776ea1483cff21 to your computer and use it in GitHub Desktop.
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
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)} |
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 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