OpenAI API response is valid but not displaying (GPT-4, JSON parsing issue?)

Hi everyone,

I’m quite new to Thunkable, and I’m currently building an app that connects to OpenAI’s GPT-4 API using the Web API component.


Here’s what’s working:

  • The API call is properly configured(headers include Content-Type: application/json and Authorization)
  • The PromptBody JSON is well-structured and uses “model”: “gpt-4” with “messages”
  • The response status is 200 OK
  • The returned response is a valid JSON, tested and confirmed using tools like JSON Formatter & Validator

Here’s the problem:

The response doesn’t show up in the app — nothing is displayed, even when trying:

  • To extract the message using:get property of object → choices → 0 → message → content
  • To display it in a Label, TextInput, or WebViewer
  • To parse the JSON first using GetObjectFromJSON, then accessing properties

We tried with both GPT-3.5 and GPT-4, and the issue is exactly the same:

The response is null or empty — even though we know it’s coming in properly.


Important notes:

  • This is not an issue with Android vs iOS
  • This is not an issue with OpenAI Services (we’re using direct API call via Web API block)
  • We believe this is a limitation in how Thunkable handles and parses nested JSON returned by the API

My question:

As someone still learning the platform:

Has anyone successfully extracted and displayed choices[0].message.content from OpenAI’s response using Thunkable?

Or is there a known workaround to parse and render this kind of nested response correctly?

Thanks in advance for your help!

JSON arrays start at index 0 but Thunkable lists start at index 1. So you need to get the first item of the “choices” array. That would be “choices[1].message”. By the way, you can simply use that for the property name and avoid using list blocks. Be careful about the double list blocks (in list [list[get property of object] get #]). You only need that if the result of the first item is also a list.

If you post the full JSON response as text here and format it using the </> in the forums toolbar above the post, I can give you more specific instructions for the property name.