Need Help with Quiz API Call

Hello, i am trying to create an AI quiz generator with a template I purchased on bubble.io. The API that came with the temp did not work for me (I copied it to my other app) so I have been tweaking it to work for my app. The issue I am having is with the generating response. It adds the brackets and it also adds the answer with the last option.


Any help is greatly appreciated! :slight_smile:

With chatgpt API calls your can explicitly request a JSON response, though you do still need to define that object in the message as far as I’m aware:

{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": [
      ]
    }
  ],
  "response_format": {
    "type": "json_object"
  }
}

I generally tend to use the ‘extract with regex’ function to grab what I want from the object after the fact, since chatgpt still only returns a JSON object string, as opposed to an object. Something like…

(?<=\"Question":")(.*?)(?=\")

The above repeated for each required field should get you the content of each key/value without including the enclosing brackets or quotes.

Send the response to a backend workflow and inside of it use Return data action, set content type to json and it will give you the clean object with field values to pick from.