0
val json = Json.parse(jsonString)
(json \ "theme" \ "structure" \ "layers")
的層JSON關鍵是按順序編號喜歡播放的Json地圖對象鍵
{0: {}, 1: {}, 2: {}}
鍵的對象,我不知道多少個鍵會出現或按鍵只的模式我鑰匙即時試圖檢索每一個存在。
我可以用
(json \ "theme" \ "structure" \ "layers" \ "0" \ "mykey")
訪問它們但有時有上百個圖層我需要能夠以編程方式遍歷他們檢查每一個「的myKey」的價值。
使用'.get'是不安全的/一個不好的做法,對'Option'或'Try' – cchantep