Android JSON parsing data Android parsing weather forecast
outline
The author recently achieved the analysis of JSON data of weather forecast, which is recorded here.
Weather forecast interface: http://wthrcdn.etouch.cn/weather_ mini?citykey=101200101
JSON data is as follows:
Final analysis effect:
Analysis Overview
1. First, the entire data received can be converted into a jsonobject object. 2. The data obtained from the data through the jsonobject object of the whole data is also a jsonobject object. You can get the temperature, city and other information in data. 3. The data in the forecast can be obtained through the jsonobject object of data, and the data in the forecast is a jsonarray object. 4. The weather information of recent days can be obtained through the jsonarray object of forecast, and each item is a jsonobject object.
code
For convenience, the author uses the volley framework. Readers need to add the following in the dependencies of build.gradle for the new project:
MainActivity.java:
activity_ main.xml:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.