Accessing decoded JSON array
PhilG1300 last edited by PhilG1300
I am new to using UIFlow, but not to programming.
I am using UIFlow on my M5Stack project.
I am having difficuly in accessing a JSON decoded array.
Within the Python code I have a snippet of code:-
Decoded_Packet = json.loads(Packet) Decoded_Location = Decoded_Packet["location"]
Which works in my application, but it won't change to the UIFlow - Blockly representation, nor save and load correctly.
So my question in Blockly what is the equivalent of:-
Decoded_Location = Decoded_Packet["location"]
Decoded_OutTemp = Decoded_Packet["stats]["current"]["outTemp"]
Which work in the Python coding.
sodoku last edited by
You should be able to use the "get key in map" block from "map"
Get key location from map Decoded_Packet
PhilG1300 last edited by
Yes your answer is correct, I have just found the answer just before you replied!!
See attached screenshot.
Many thanks for the advice.
Kombistack last edited by
Thanks Phil, this was very helpfull for me too.
rmorgan last edited by
@kombistack Im trying to do something similar to this. I'm subscribing to an AWS IOT topic which is publishing a JSON. I can receive the whole message but in trying to extract one field from the JSON its not returning anything. Pic below
ajb2k3 last edited by
@rmorgan please dont double post.