For my project, I followed the “How to use Thunkable Web API Component: Countries Info App” tutorial because the structure of the response to the API I am querying is the same as the one in tutorial. Yet my app only displays one of the object’s properties and none of the properties of the objects in an array/list within the response. Below is an example of the response as well as my work. What am I doing incorrectly?
If you cannot get the value of the JSON node, then use this error search algorithm
Check that the JSON data has arrived in the desired variable. If the data has not been received, then there is an error in the request to the server; if it is, then go to the next step.
In the given variable, get the data of the root node. If the expected ones were received successfully, then get the data of the next level and so on before building the path.
No need to build a path right away. Build the path in parts and each time check its correctness.
First, you need to make sure that there are no errors and the desired block contains correct data. And you try to work with them immediately without checks. It’s like a driver going 100 miles an hour into an unfamiliar dark tunnel and thinking there’s a way out and everything will be fine. And if there is a blank wall 50 meters away, and the builders forgot to put fences in front of the tunnel?
I cant see there is errors since the text comes fine when i use the respons block directly on the green label set text block. There i see the text fine and i can make a fine list with , seperation and sort it that way. But that is not the right way to do it…
You can think of JSON as a cabbage. To get to the stalk, you need to tear off one leaf after another sequentially. Imagine that the property of an object is a stump. How do you get it? First, get the external object in Label. Text. If it worked, then you will get the first child object. If it worked, then the next one, and so on. Do you understand this idea?
Tell me what the brackets [ and ] and { and } mean in JSON data?
You answered correctly, the brackets [] are an array, but why don’t your blocks have a block for working with an array?
The value of the “Customers " node is a list of objects, so you need to use a block that returns a list item - it will be an object. and then you need to get the property of this object. Now you understand what you need to do?
I recommend that you spend another 10-15 minutes on this task. You will be very pleased if you solve it yourself. You will understand how you can solve similar problems.
If you can’t solve it in any way, then open the project with the solution using the link.
I have earlyer asked how the text clicl block works. Now I have made this.
It should work like this,
When you click the C_password1_txt field is shoul write the name tah is registret to the recorded email. What is wrong because i dont get inside the block and the test function is not writen in the Navn text field. Or have I completely misunderstod these text functions???
First, you need to clearly understand what parameters are required by the web server you want to connect to, what data transfer method it requires, how authorization occurs, and so on.
If you send an invalid request to the server, it will never return the data you need. It will return an error that you should get and that will make it possible to understand what is being done wrong
Okay to simplify it a little.
Should the text “test function” come op in the Navn_txt field when I activate the C_password1 text field??? If yes, it dosent.!!!
I think I understand. You, like some other users, just don’t have a button click handler working. Unfortunately, I don’t know the solution to this problem. Try clicking on Label instead of the button
That is also what I do. And as far as I understand should i execute what is inside the block when i activate the textfield and start writing. Isnt that right???
But is there somewhere I can read about how the click text block works.