This is my first question here, so sorry if there is anything wrong with my post.
I’m making a project using both Thunkable and Python. I have made a web server using the python library Flask and I am using Thunkable as my front end. So in my code, I make a request to my site:
So I am able to connect with my server and receive data from it, but for some reason, my thunkable program cannot recognize it is JSON and hence errors out during the ‘create object from JSON’ part.
I have tested and I have received the data, but I don’t know why thunkable is erroring out. Any suggestions?
From the server side everything is going fine. I’m just using some test data for now, like {TEST : “test”} or something like that. Also, if I directly display the received data in a label, it shows up properly. So I think the problem is Thunkable does not recognize it as a JSON.
so if you paste exactly what the server is returning into the test blocks above, does it work? If so, it’s a web server problem. If not, it’s a web_api problem.
I suggest displaying labels with the server response, status, and error while testing. You might learn something.
I agree that it should. And when I set a variable to those values, it works fine. So what blocks are above the small screenshot you posted? Show me where you set the variable “name”? And show me the label with the unprocessed server response? Or PM me a link to the server or to the project so I can see it myself, if you like?
I can’t run your code. Even if I wanted to recreate it all out from the screenshots, I can’t actually see the full URL you’re using in that join block, so there’s no way I can recreate it here.
I remixed your project. Thunkable is getting ‘null’ for response when I try it, although when I paste the URL into a browser I get the text you listed. I also tried with curl, and I see the server sending a 200 status, so I’m not sure why that’s not getting through Thunkable either.
I wonder if you need to get the server to send a different content type? Can you get it to report a content-type of application/json instead of text/html ? I’m not sure this is the problem, but it’s my best guess.
When you get a response from the server it will most probably be in JSON format. Thunkable sees JSON as formatted text and cannot work with it.
To use the get property block first convert the JSON to object then use the object blocks. Use get object from JSON for Thunkable to treat at as an object.