“boundingbox” : [ “-17,2221106” ,"-17,2217947" ,"-46,8571919" ,"-46,8549171" ]
how can I get the values of this array?
I wanted to receber these values: “-17,2221106” and “-46,8571919”
“boundingbox” : [ “-17,2221106” ,"-17,2217947" ,"-46,8571919" ,"-46,8549171" ]
how can I get the values of this array?
I wanted to receber these values: “-17,2221106” and “-46,8571919”
First, the JSON you pasted here is not valid.
The valid JSON will look like this
{"boundingbox” : [ “-17,2221106” ,"-17,2217947" ,"-46,8571919" ,"-46,8549171" ]}
So the JSON string is a JSON object with a key boundingbox
with value as a JSON array of strings.
The values you want to get are at indices 1, 3 (or 0, 2 )
To extract those values, use the JSON component (search for it in the components panel). This component allows you to get the data from JSON.
To be continued…
No, you don’t need the for loop and break block. Just move the two “add items…” blocks outside the for loop.
The “boundingbox” object is 2 levels deep. You have to select the 1st item of the 1st item to get the “boundingbox” object.
No, that’s not what I meant.
Try this
set global boundingbox to lookup in pairs key "boundingbox"
pairs select list item list select list item list get global DecodeJson
index 1 index 1
notFound "notFound"
what about using Do it to debug your blocks?
see tip 4 here App Inventor: How to Learn | Pura Vida Apps
Live Development, Testing, and Debugging Tools
probably that would be easier and faster compared to asking in the forum?
Taifun
Taifun
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.