I'll try to make this as simple as possible to follow. All you need is the OkHttpUtils2 and JSON libraries selected in your libraries tab.
Create a Global String variable, lets call it
JSONResult.
Use the following code to get your JSON feed, just replace the URL with your own.
'Test URL
Dim j As HttpJob
j.Initialize(Null, Me)
j.Download("http://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b6907d289e10d714a6e88b30761fae22")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
JSONResult = j.GetString 'Store the contents of j.GetString into JSONResult.
Else
Log($"Error: ${j.ErrorMessage}"$)
End If
j.Release
Copy the JSON j.GetString results and paste them into the following webpage page created by Erel, then click the
Parse button.
http://basic4ppc.com:51042/json/index.html
The webpage that Erel created automatically generates the B4A code for you, all you have to do is copy and paste the code into your B4A project and manipulate the code.
For the above example URL, the JSON Tree code generator created the following code.
'Code generated by the JSON Forum page, thank you Erel.
Dim parser As JSONParser
parser.Initialize(JSONResult)
Dim root As Map = parser.NextObject
Dim dt As Int = root.Get("dt")
Dim coord As Map = root.Get("coord")
Dim lon As Double = coord.Get("lon")
Dim lat As Double = coord.Get("lat")
Dim visibility As Int = root.Get("visibility")
Dim weather As List = root.Get("weather")
For Each colweather As Map In weather
Dim icon As String = colweather.Get("icon")
Dim description As String = colweather.Get("description")
Dim main As String = colweather.Get("main")
Dim id As Int = colweather.Get("id")
Next
Dim name As String = root.Get("name")
Dim cod As Int = root.Get("cod")
Dim main As Map = root.Get("main")
Dim temp As Double = main.Get("temp")
Dim temp_min As Double = main.Get("temp_min")
Dim humidity As Int = main.Get("humidity")
Dim pressure As Int = main.Get("pressure")
Dim temp_max As Double = main.Get("temp_max")
Dim clouds As Map = root.Get("clouds")
Dim all As Int = clouds.Get("all")
Dim id As Int = root.Get("id")
Dim sys As Map = root.Get("sys")
Dim country As String = sys.Get("country")
Dim sunrise As Int = sys.Get("sunrise")
Dim sunset As Int = sys.Get("sunset")
Dim id As Int = sys.Get("id")
Dim type As Int = sys.Get("type")
Dim message As Double = sys.Get("message")
Dim base As String = root.Get("base")
Dim wind As Map = root.Get("wind")
Dim deg As Int = wind.Get("deg")
Dim speed As Double = wind.Get("speed")
Basically no complicated coding needed, everything you need to know is in this post
Enjoy...