Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> val json = """{"asks":[[0.251,300],[0.2587,400],[0.2667,400],[0.414,100]],"bids":[[0.191,1000],[0.1956,400]]}
| """
json: java.lang.String =
{"asks":[[0.251,300],[0.2587,400],[0.2667,400],[0.414,100]],"bids":[[0.191,1000],[0.1956,400]]}
scala> import net.liftweb.json._
import net.liftweb.json._
scala> import JsonParser.parse
import JsonParser.parse
scala> import JsonAST._
import JsonAST._
scala> val js = parse(json)
js: net.liftweb.json.JsonAST.JValue = JObject(List(JField(asks,JArray(List(JArray(List(JDouble(0.251), JInt(300))), JArray(List(JDouble(0.2587), JInt(400))), JArray(List(JDouble(0.2667), JInt(400))), JArray(List(JDouble(0.414), JInt(100)))))), JField(bids,JArray(List(JArray(List(JDouble(0.191), JInt(1000))), JArray(List(JDouble(0.1956), JInt(400))))))))
scala> for {
| JField("bids", bids) <- js
| JField("asks", asks) <- js
| } yield asks -> bids
res2: List[(net.liftweb.json.JsonAST.JValue, net.liftweb.json.JsonAST.JValue)] = List((JArray(List(JArray(List(JDouble(0.251), JInt(300))), JArray(List(JDouble(0.2587), JInt(400))), JArray(List(JDouble(0.2667), JInt(400))), JArray(List(JDouble(0.414), JInt(100))))),JArray(List(JArray(List(JDouble(0.191), JInt(1000))), JArray(List(JDouble(0.1956), JInt(400)))))))
scala> dpp@cobra:~/tmp/chat$
--
Lift, the simply functional web framework
http://liftweb.netBeginning Scala
http://www.apress.com/book/view/1430219890
Follow me:
http://twitter.com/dppBlog:
http://goodstuff.imSurf the harmonics