Need Help With Api

i checked the response it returns whatever there is i am supposed to receive.
But i cant understand how to get the word property

word: "USA",
phonetics: [
text: "/ˌju ˌɛs ˈeɪ/",
audio: ""
meanings: [
partOfSpeech: "abbreviation",
definitions: [
definition: "United States of America."
definition: "United States Army."

I get this when i just check the response
probably because there is a square bracket in the result this error maybe caused , can you tell how to handle this?

I have a small doubt: since you already have USA written in the URL, that means you already know the word, why are you using an API to get the same thing?

no , that is just an example , i have a random word generator and that will be used to generate a word. Also , i actually needed the audio property but thought the word property would be easier to fetch

1 Like

Oh, ok. May I ask which random word generator you are suing, since I’m looking for one myself?
thunkable code:
Also , this api is not owned by me nor am i promoting it :grinning:

1 Like

Thank you very much! I just pasted the response from the dictionary API into a json formatter, and it says that the JSON is invalid. Can you do this:
when you set the web API’s url, paste it into an input, and add a wait 4 seconds block. In that time, copy the response and paste it here. I want to see what response you are getting, not just the sample data.

1 Like

this is what i get in thunkable
[{“word”:“USA”,“phonetics”:[{“text”:"/ˌju ˌɛs ˈeɪ/",“audio”:“"}],“meanings”:[{“partOfSpeech”:“abbreviation”,“definitions”:[{“definition”:"United States of America.”},{“definition”:“United States Army.”}]}]}]

1 Like

Cool, let me paste it and tell you what I find.

Thanks , you can use this link too

1 Like


OK, so there’s something very weird going on.
When I try to paste your first response in a JSON formatter, it says Bad String, and doesn’t format it. When I paste the response from the link, it formats it correctly.

That’s strange

1 Like

Aha! In the first response, you have curved quotation marks: “ ”. They’re supposed to be straight, like this: " ". Before parsing, use a replace block to replace all the curved quotation marks with the straight ones.

Where to do this exactly?

The problem is that your API returns invalid JSON. JSON cannot contain comments (lines that start with //).

Where are those lines in the random word generator or word detail finder?

Actually, I was wrong. Thunkable seems to handle those comments okay in the response.

This works:

You have to take the first item of the list before getting the property “word” because the JSON response has an array ([ ] brackets).

1 Like

You can see this is the case if you paste the response to something like this:

Into this site and click Tree Viewer:


Also , how can i get the text value in the phonetics section/

So the problem with asking for one property value and not understanding how JSON works is that then you need a different value… and then a different value…

Please see my tutorial video which explains how to parse JSON. If you still need help after that, post a screenshot of the blocks you tried and someone can help you with them.