Accessing a JSON array using a variable

I’m trying to access a JSON array using a variable (as in with a for loop) and it seems that you cannot access arrays in JSON with a variable. Anyone else seeing the same thing?

Thanks, Bruce

https://x.thunkable.com/copy/22af67e157d068554d20200fa5c4e691

Can you explain what part you want?
You should not expect others to guess that.

Additionally, the get property for array element 9 in the first example I do NOT know where to find it in the blocks menu. I hate to say this, but it just magically appeared when I was trying to resolve this. (and it works, too)

Not sure I understand the questions. I CAN retrieve the part of the JSON array that I need (temp_min)

But it appears when I try to get the element of the JSON array (in this case, 0), I can literally specify the zero either as a number or a string, but I cannot use a variable.
Did that help?

1 Like

try this

This way you get the element of the order required. In the example I am taking the first element in the array.

[Edit]
I changed the blocks to get the first, the last and a random one

This is the screen

This is how easy to work with arrays in Thunkable.

So, out of curiosity, am I accessing the wrong documentation, or is this a matter of Thunkable documentation catching up with actual code.

This was what I found/used. (Objects - Thunkable Docs)

1 Like

And, THANKS for the solution! It works.

1 Like

This documentation was to show additional features in the Get property that was added later and not in the original documentation.

I would advise to see this post by @tatiang

Very informative and to the point.