Last active
February 16, 2017 09:41
-
-
Save prayagupa/b17e0f5878ce09804129851510ea6790 to your computer and use it in GitHub Desktop.
scala
This file contains 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 scala.util.parsing.json.JSONObject | |
/** | |
* Created by prayagupd | |
* on 2/16/17. | |
*/ | |
object Test { | |
def main(args: Array[String]): Unit = { | |
val s = List(JSONObject(Map("language" -> "scala", "desc" -> "too many libraries")), | |
JSONObject(Map("language" -> "java", "desc" -> "too many libraries")), | |
JSONObject(Map("language" -> "clojure", "desc" -> "too many libraries"))) | |
println(s"${s.mkString(",")}") | |
} | |
} | |
//output | |
// {"language" : "scala", "desc" : "too many libraries"},{"language" : "java", "desc" : "too many libraries"},{"language" : "clojure", "desc" : "too many libraries"} |
This file contains 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 scala.util.parsing.json.{JSON, JSONType} | |
/** | |
* Created by prayagupd | |
* on 2/16/17. | |
*/ | |
object Test { | |
def main(args: Array[String]): Unit = { | |
val json = | |
""" | |
{ | |
"language" : "scala", | |
"desc" : "toooo many libraries" | |
} | |
""".stripMargin | |
val jsonType : JSONType = JSON.parseRaw(json).get | |
val s = List(jsonType, jsonType, jsonType) | |
println(s"${s.mkString(",")}") | |
} | |
} | |
//output | |
// {"language" : "scala", "desc" : "toooo many libraries"},{"language" : "scala", "desc" : "toooo many libraries"},{"language" : "scala", "desc" : "toooo many libraries"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment