Share MQTT subscribe message in MIT AppInventor

Hi, everybody
I need to get each data in this message. How to do this in MIT AppInventor?
I'm recieving it from MQTT.
Does anyone can help me?
{"idRemote":8265827,"idConcentrador":820656,"ativado":false,"alerta":0,"temperatura":0,"umidade":0,"tempoRestante":0,"tomada":false,"RSSI":-106,"SNR":12,"netPing":311.8286,"RSSI WiFi":-67}

What you get is json. You can convert json to dictionary. The relevant block is in the "Web" component.

Thanks Patryk. That's my problem. I don't know how to create a php script to read it.
I get to read the message only as a single text. Can you suggest a php script, that I can use "Web component", to share each part of the message to a different text box?

You cannot run php scripts on AI2.

You would use the dictionary blocks to help you parse the incoming json

Use web component to decode json message and dictionary blocks to parse message. See example

It works. Thank you very much!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.