{"id":5309,"date":"2016-11-28T13:04:39","date_gmt":"2016-11-28T13:04:39","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5309"},"modified":"2016-11-28T13:04:39","modified_gmt":"2016-11-28T13:04:39","slug":"get-array-json-scala-play","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/get-array-json-scala-play\/","title":{"rendered":"Get array from JSON in Scala Play"},"content":{"rendered":"<p>You can extract arrays from Json objects in Scala Play if you cast to JsArray, like so:<\/p>\n<pre lang=\"scala\">\nval speakers = (obj \\ \"speakerName_ss\").toOption match {\n  case Some(x: JsValue) => {\n    x.asInstanceOf[JsArray].value\n  }\n  case None => {\n    List()\n  }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using JSON arrays in Scala<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[302,322,480],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5309"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5309"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5309\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}