KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using the build in JSON class in Scala 2.8 to parse JSON code. I don't want to use the Liftweb one or any other due to minimizing dependencies. The way I am doing it seems too imperative, is there a better way to do it? import scala.util.parsing.json._ ... val json:Option[Any] = JSON.parseFull(jsonString) val map:Map[String,Any] = json.get.asInstanceOf[Map[String, Any]] val languages:List[Any] = map.get("languages").get.asInstanceOf[List[Any]] languages.foreach( langMap => { val language:Map[String,Any] = langMap.asInstanceOf[Map[String,Any]] val name:String = language.get("name").get.asInstanceOf[String] val isActive:Boolean = language.get("is_active").get.asInstanceOf[Boolean] val completeness:Double = language.get("completeness").get.asInstanceOf[Double] }
Tags (comma-separated)
Save Edits
Cancel