Array JSON separation with the same key (english/pt-br)

Hello everyone,

I'm facing an issue while trying to display multiple products in my AppInventor app. The problem is, when I fetch data from a server in JSON format containing multiple products, the app is only showing one product at a time instead of all the products.

JSON Data Structure: I receive a JSON response with the following structure: [{"status":"ok","codigo_produto":"4","nome_produto":"Camiseta Polo","valor_produto":"89.9","estoque":"50"},{"status":"ok","codigo_produto":"5","nome_produto":"Ferrari Black","valor_produto":"250","estoque":"3"},{"status":"ok","codigo_produto":"8","nome_produto":"superproduto","valor_produto":"250","estoque":"36"}]


the produto_formatado showing only the superproduto section

You have desinged it wrongly. As per you blocks, when button is clicked, app does GET request and print the json decoded value alone into the label. instead move this block after parsing the jsontextdecode and try again

this will give you the list of all items based on the key value you used in for each items in the list event. The same like you can set up in weg bot text and not in button click. Remember, After the Button click only you are taking GET request. So, after getting GET response do related parseJson and make inti list

image

The reason for your problem is, You should try with add items to the list, else you will be getting the last item that is printed on the global variable

Try these:


Capture
JSON_to_table.aia (5.7 KB)

thanks! its solved. now i gonna try to format the text and add to a listview

YAML format is great for ListView Elements.