# Thunkable unable to recognize JSON received from API

**URL:** https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953
**Category:** Questions about Thunkable X
**Tags:** webapi
**Created:** [May 28, 2021, 10:33am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953 "2021-05-28T10:33:35Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 10:33am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/1 "2021-05-28T10:33:35Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41b25bca97f1a20a564d982149fadbfc907425ca.png)

And my server side code is:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/f/cff3f40a924aa5193d48d57e2ee2980a9289e233.png)

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?

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 10:46am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/2 "2021-05-28T10:46:04Z")

</div>

Could you please post the JSON that isn’t working? Put the server response in a label temporarily, or have the python log exactly what it’s sending?

Or just do that get request in a browser window?

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 10:48am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/3 "2021-05-28T10:48:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 11:42am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/4 "2021-05-28T11:42:59Z")

</div>

> [@d34thbychocl4t3](#):
>
> {TEST : “test”}

You’re missing your quotes on TEST. This works:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/5/e59c921099aedce8bee470f8b762d1c2598b6560.png)

If your server is actually returning what you posted, that’s your problem - badly formatted JSON.

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 11:48am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/5 "2021-05-28T11:48:38Z")

</div>

Ah sry, that was a typo. In reality it was

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/398c6df5630e8e0cdcfd1fce9471f67f6e2fd92b.png)

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 11:51am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/6 "2021-05-28T11:51:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 11:59am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/7 "2021-05-28T11:59:02Z")

</div>

There is nothing wrong. Response shows the text I gave, status shows 200 and error shows undefined.

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 11:59am UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/8 "2021-05-28T11:59:45Z")

</div>

Another thing, it seems the error is on this line

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/4/242fc859761ba944088cad577b4d427a28772056.png)

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 12:05pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/9 "2021-05-28T12:05:10Z")

</div>

That pink block will definitely cause a crash if you’re asking for a property that doesn’t exist in your object.

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 12:05pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/10 "2021-05-28T12:05:46Z")

</div>

Does TEST not exist? {“TEST”:“LMFAO”}?

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 12:08pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/11 "2021-05-28T12:08:54Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 12:10pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/12 "2021-05-28T12:10:39Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/c/dc4c555ca8993177e7a7f11a86c2a1c705e96ee2.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/8/0824ab1e4554c73a497f941ae3688518a823879b.png)

I’m just printing it to a label I already had set up

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/3/634d8f7fb19847b51a0dafb8131fee20a7380cb8.png)

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 12:11pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/13 "2021-05-28T12:11:51Z")

</div>

your last picture doesn’t show the server response?

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 12:13pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/14 "2021-05-28T12:13:03Z")

</div>

No it does, it is just what it looks like before it.  
Just change the code to  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/8/c86b502978d2fbbdb79f2360bccc5ce1d55016a8.png)  
And it should print there

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 12:14pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/15 "2021-05-28T12:14:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 12:15pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/16 "2021-05-28T12:15:20Z")

</div>

The url is [https://SpottedPureAnimatronics.ismailatrepl.repl.co/loginl](https://SpottedPureAnimatronics.ismailatrepl.repl.co/loginl)

---

<div class="post-metadata">

### Author: ![d34thbychocl4t3](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@d34thbychocl4t3](https://community.thunkable.com/u/d34thbychocl4t3)
#### Post date: [May 28, 2021, 12:19pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/17 "2021-05-28T12:19:27Z")

</div>

Another thing, I don’t know why, but if I list out all the all the properties it gives me an infinite list starting from 0 like [0,1,2,3,4,5] etc…

---

<div class="post-metadata">

### Author: ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)
#### Post date: [May 28, 2021, 12:31pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/18 "2021-05-28T12:31:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [May 28, 2021, 2:41pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/19 "2021-05-28T14:41:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [May 28, 2021, 2:53pm UTC](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953/20 "2021-05-28T14:53:01Z")

</div>

You can see an example of how to use the `get object from JSON` block at the 17:49 mark in my tutorial video:

> [@API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575):
>
> Using APIs in Thunkable and understanding how to parse JSON to get certain data from the API response is both a popular and a difficult aspect of using Thunkable. It’s not so much difficult because of Thunkable but because every API url format is different, every API documentation is different, every JSON response is different, etc. In this video, I spend a lot of time talking you through some best practices. It’s not a quick tutorial because if you rush through setting up an API in Thunkable, …

[Next page](https://community.thunkable.com/t/thunkable-unable-to-recognize-json-received-from-api/1312953.md?page=2)
