https://sparse-dense.blogspot.com/2019/12/another-example-using-json-decoding.html
In the previous article, I introduced a JSON Decode Extension to easily extract the necessary information from the JSON file received from a Web service. This time, in order to test this Extension, I created a simple book search application. There are many applications of this type, but the concern here is how easy it is to decode JSON files.
Results from the book search app |
JSON text sent back from the web service (a part) |
Complete App Inventor source program of the book search |
However, there is still room for improvement. For example, the current Extension receives the following list individually as a search instruction string.
query for title -> "items,volumeInfo,title"
query for authors -> "items,volumeInfo,authors"
query for publishedDate -> "items,volumeInfo,publishedDate"
query for thumbnail -> "items,volumeInfo,imageLinks,thumbnail"
query for description -> "items,volumeInfo,description"
This is a little inefficient. The values of tags at the same hierarchical level should be collectively received as follows. In the near future, we plan to revise the extension so that we can respond to this. That way, you can make this application even easier.
query for several items -> "items,volumeInfo,[title,authors,publishedDate,description]"
query for thumbnail -> "items,volumeInfo,imageLinks,thumbnail"
hi
返信削除i try your extension
i would like to know if i can decode this kind of json format with it :
{"blues":[{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"v","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"v","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"v","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"p","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":7000022,"prenom":"je","nom":"test","piece":"p","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"p","datecreation":"","datesortie":"","dateretour":"","etat":"g"},{"id":"1","codeb":"","prenom":"je","nom":"test","piece":"p","datecreation":"","datesortie":"","dateretour":"","etat":"g"}]}
regards
Sorry, I do not understand what you expect as a result of decoding. However, for example, if you want to get the value of the "codeb" tag of the fifth element under the "blues" tag in this json file, you can do something like the following figure.
削除https://www.dropbox.com/s/2yh3asw86pjeebb/b.png?dl=0
As a result, "7000022" will be obtained. I hope you find it useful.