Skip to content

Instantly share code, notes, and snippets.

@brentsowers1
Created March 6, 2014 02:40
Show Gist options
  • Save brentsowers1/9381211 to your computer and use it in GitHub Desktop.
Save brentsowers1/9381211 to your computer and use it in GitHub Desktop.
Parsing JSON in to a Map with Lift JSON
import net.liftweb.json._
val jsonStr: String = """{"key1":"value1","key2":1}"""
val jsonJVal: JValue = parse(jsonStr)
val jsonMap: Map[String,Any] = jsonJVal.values.asInstanceOf[Map[String,Any]]
for ((key,value) <- jsonMap) {
println("key = " + key + ", value = " + value.toString)
}
println("Key 1's value is " + jsonMap("key1"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment