Plugin API Connector with POST Request & JSON Array

I’ve a POST Request that consists of an array
{
“name”: “string”,
“levels”: [
{
“name”: “string”,
“desc”: “string”,
“order”: 0
},
{
“name”: “string”,
“desc”: “string”,
“order”: 1
}
]
}

The number of levels is defined by user input.
How can I configure this in the API Connector. I can only configure the JSON body with definite number of array elements

Try building up the array from joining a list together into text. If possible, build up the list as the items are created.

Are the “name”, “desc”, “order” from fields of the same data thing? You could use the Toolbox plugin with “List Item Expression” to help build up the text array from a list of things, there is an example here:

Thanks Mishav, I’ll give that a go & i’ll get back to you.

Yes I got this partial working with the List Expression in the Toolbox plugin.

I have a weird problem. As you suggested I built the created a list by creating a Thing every time an item was created.
Then I added a Save button. When the Save button was clicked I used the List Expression to create the list & set this list as the JSON array in the POST request.

The problem I have is that when I set the Data Source for the List expression I can see in the debugger that the list expression evaluates to an empty string

In the image there are 2 elements in the list but I can’t see any data for these elements. However I know that these elements were created. Everytime I try to set the Data Source it returns an empty string.

Any ideas what the problem could be. Could the database be corrupted?

Try showing a text field on the page with the same data source, and another text field to show the List Item expression result.

If you are creating and storing each item in the JSON array as records are created, you won’t need to use List Item Expression. That suggestion was more for parsing the entire data list in one go.