Answer the question
In order to leave comments, you need to log in
How to make a request to OpenWeatherMap and process the JSON response?
Good day.
I need to write a simple "weather forecast" application. I am using JAVA language.
I have a problem with forming a request and receiving a response from OpenWeatherMap with further processing. The question is how to do it correctly, otherwise the application starts but does not show anything.
And tell me how to use the debugger correctly? I wanted to see if the JSON object was empty, but I never found out.
I used this article as an example: https://code.tutsplus.com/ru/tutorials/create-a-we...
But the article is from 2014 and in it, it seems, the old request and response format compared to what currently offers Open weather map.
Project link: https://github.com/ZoRaToS/SimpleWeatherForecast
If it's not difficult for anyone, point me in the right direction, please.
Answer the question
In order to leave comments, you need to log in
Here, here is the OpenWeatherMap API documentation - https://rapidapi.com/community/api/open-weather-map
Here, either for Retrofit requests - https://square.github.io/retrofit/
Here, either for Json deserialization to an object (Jackson, Gson) -
https://www.baeldung.com/jackson
https://www.baeldung.com/jackson-vs-gson
Now it remains only to study the API according to the documentation, execute the request using Retrofit and deserialize json to an object using jackson || gson
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question