我想從 url 下面的 JSON 中"stations"的鍵返回值。我如何在 Scala 中做到這一點?"base"https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b6907d289e10d714a6e88b30761fae22這是我嘗試的。import scalaj.http._import play.api.libs.json.{JsValue, Json}object JSON {def convertToJson(): String = { val url: String = "https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b6907d289e10d714a6e88b30761fae22" val response: String = Http(url).asString.body val parsed: JsValue = Json.parse(response) parsed.get(base)}}
如何從 Scala 中的 JSON 中的鍵中獲取特定值?
慕工程0101907
2022-07-14 09:49:18