Turning text array into object array

Simple question, hoping there is a simple answer

If i start with an array of objects like a query

mydata: [
{
name: "Ben"
},
{
name: "Brian"
},
{
name: "George"
},
{
name: "Patrick"
},
{
name: "Teodor"
}
],

and i turn it into a text array

Textarray: [
"Ben",
"Brian",
"George",
"Patrick",
"Teodor"
],

Then say i delete an entry, say Brian

is there an easy way to turn it back into the object array, basically the opposite of flatten.

mydata2: [
{
name: "Ben"
},
{
name: "George"
},
{
name: "Patrick"
},
{
name: "Teodor"
}
],

Looks like a repeat of Textarray named “mydata2” and exclude everything from output, then inside the repeat a set value named “name” with value equal to $value.

Thanks Ken, had tried the repeat already and observed the correct output BUT completely forgot you can create a new object by referencing the repeat itself by name

so a subsequent action of set value newobject = {{repeat}} was exactly what i was looking for

newobject: [
{
name: "Ben"
},
{
name: "George"
},
{
name: "Patrick"
},
{
name: "Teodor"
}
]

I don’t understand why you did Set Value newobject, you can use the repeat “object” directly

Just for illustration purposes.

Continuing from your threat here arraylist
I suppose if you just add all in the arraylist (with schema, “name”:string)
(Haven’t tested it)

I think I now get how array lists work @famousmag, it’s actually simple once you realise how to convert arrays of object to arrays of text and back.

I will document all actions in array lists fully, hopefully today.

1 Like

Thank yoy for your effort Brian!

I suppose you are about to demonstrate how to use the ArrayList component contains and indexOf with an array of objects as it is meant to be used brother

That’s the plan!

1 Like