Is it possible to convert a basic stringified array into a defined array (probably wrong terminology)

Hey all,

I have a super basic array of ids that i’m converting into a string to send via a $post field to the backend.

This looks something like id1,id2,id3,id4…

What I’d like to convert this into somehow is an array that looks like this:

Screen Shot 2020-12-08 at 5.37.35 pm

{
  "query": {
    "ids": [
      {"values": "ids"}]
  }
}

Please share the form structure where you are sending the data from. There are ways to setup the NAME of input elements to create a complex JSON on the server request data.
Something like name="ids['values][]" should make the $_POST look like what you want.

Thanks @sid - unfortunately nodeJS doesn’t interpret this kind of structure very well, I’ve spent a bit of time on this with patrick and he confirmed as such - is this the only way you can think of achieving this?

Note - bit of an error on my part, I’m not using .stringified for this particular field, that was for the field below - I’m setting the value of an array in the text area, which still outputs th same result: id1,id2,id3,id4 in the field before being sent to the backend.

Wasn't aware of this. Haven't worked much on NodeJS in Wappler or otherwise.

Another option could be to use custom formatters on both client and server sides.

Isn’t it just a comma separated list, a simple split on comma would do the trick.

query.ids.values.split(',')

Hey @patrick - the data comes in as a single line, without the query.id.value, that's what I'm trying to conver it into.

So data I have to play with:

"value1,value2,value3,value3"

Which I want to convert to:

{
"query": {
"ids": [
{"values": "ids"}]
}
}