I am new to Kotlin beginner and trying to create a code to fetch data from JSON.
I'd like to fetch the data from "value" inside "forecastMaxtemp".
Here is my code. I am tried as below but not successful.
...
Response.Listener { response ->
temp.text =
response.getJSONArray (name"weatherForecast").
getJSONObject(0).
getJSONObject("forecastMaxtemp").
getString(name"value")
},
JSON Data
{"generalSituation":No Alarm",
"weatherForecast":[{
"forecastDate":"20211004",
"week":"Monday",
"forecastWind":"East force 4 to 5.",
"forecastWeather":"Sunny periods.",
"forecastMaxtemp":{"value":31,"unit":"C"},
"forecastMintemp":{"value":27,"unit":"C"},
...
...
]
}