How to properly format an API Post Object array?

HI All

I am trying to Post via Bubble API connector to typeform using the API, but need to include a nested array option with dynamic data.

For example using this code:

"welcome_screens": [
    {
      "ref": "nice-readable-welcome-ref",
      "title": "Welcome Title",
      "properties": {
        "description": "Cool description for the welcome",
        "show_button": true,
        "button_text": "start"
      }
  }

How do I add this in the Multiline field so that is works. At the moment the error is:

here was an issue setting up your call.

API Connector error: this body could not be parsed as JSON “welcome_screens”: [ { “reference”:, “A title”:, “properties”: { “A description”:, “true”:, “Start”: }

Attached below is how its set up:

(There is a closing bracket missing in the image, but is as above.)
It works for normal key and value at top level, but the Nested array I can not get to work!

It would be good if we had a clear example of how this should be set up, I could not find one :frowning:

Or is it supposed to be something like:

"welcome_screens": [
    {
      "ref": "<reference>",
      "title": "<Welcome Title>",
      "properties": {
        "description": "<Welcome description>",
        "show_button": <show>,
        "button_text": "<Button text>"
      }
}

Its still doesn’t work though.

Your JSON structure is wrong…

Change it to

{
“welcome_screens”: [{
“ref”: “”,
“title”: “”,
“properties”: {
“description”: “”,
“show_button”: “”,
“button_text”: “”
}

	}

]

}

Note that I have changed the last curly brace to a square bracket

Check out this link…they have explained the concept well

Edit: There are some formatting issues when I am copying the JSON object to my answer…I will just sort that out


Okay so I reformatted your JSON object with the help of JSON lint

I have attached a screenshot of the correct JSON object you need to use in your API

1 Like

Awsome thanks!

I read the description and also had a play with the JSON validator to add in an extra top level key. Works great!

{"title": "<Title>",
"welcome_screens": [
    {
      "ref": "<reference>",
      "title": "<title>",
      "properties": {
        "description": "<description>",
        "show_button": <show>,
        "button_text": "<Button text>"
       }
      }
    ]
}

And for anyone who wonders what the brackets < > e.g “< some stuff here >” is it makes the value dynamic and you can add to your workflow!

This topic was automatically closed after 70 days. New replies are no longer allowed.