2019年12月6日金曜日

Another example using JSON Decoding Extension

This article shows an example of using the JSON Decoding Extension I developed. Below are descriptions of this extension:

https://sparse-dense.blogspot.com/2019/01/a-json-decoding-extension-for-app.html
https://sparse-dense.blogspot.com/2019/01/a-json-decoding-extension-for-app_19.html

First of all, I would like to thank many people for their interest in this extension. In fact, these two articles have been accessed more than 1,500 times in total, but sometimes there are inquiries that they can't use it well. So here's another example that's simple but practical. It is a display of the weather forecast using OpenWeather ([1][2]). Here, the weather forecast of Sapporo City in Japan, up to five days in advance every three hours is displayed. An example of a JSON text as output from OpenWeather is shown in FIg.1. Some parts are folded in the figure, but if all are expanded, there are 1,341 lines.


In this JSON text, all the tag values shown in red frame are taken out and displayed on the smartphone as shown in FIg.2. In other words, the city name, date and time, temperature, and weather are displayed. In order to use OpenWeather in an application, it is necessary to obtain an API Key.


Here are the points of using the extension (FoYoJSON) to decode this JSON text. For example, to get the city name "Sapporo-shi", treat it like Fig.3. In addition, to retrieve all the weather forecast every three hours in order of time, write as Fig.4.



The complete source code (blocks) of this application is shown in Fig.5.



If you take a little more time, you can create a more practical application as shown in Fig. 6, where there are four cities registered and can be switched with the button.



Thanks
I found out that this Extension was introduced by CERCA [3]. Thank you for your correct understanding of my design intent and usage.

References

[1] to get OpenWeaterMap API guide:
https://openweathermap.org/guide
[2] to get City ID:
http://bulk.openweathermap.org/sample/city.list.json.gz
[3] CERCA NEL, Estrarre dati da JSON con una comoda estensione di appinventor, novembre 15, 2019
https://osmtreeathlon.blogspot.com/2019/11/estrarre-dati-da-json-con-una-comoda.html

0 件のコメント:

コメントを投稿