How to create object in server action?

I need an object like this:

{
"email@email.com": {"ref_id":"999"}
}

Where the email and the ref_id values are variables.

So I have successfully created this object with this set value:
image

{{
{email@email.com:{ref_id:999999}} 
}}

But my issues come when trying to place my variables:

  • This doesn’t work: image
    it simply makes “to_email” a string: image

I feel like this is much harder than it should be. Hopefully I’m missing something.
Please help :slight_smile:

@JonL I have a feeling this would be an easy RunJS one-liner? Any chance you can work your magic while Patrick finds time to make it easy for the peasants?

Not at my computer, but couldn’t a simple group step do the job for the nesting?

You should be able to wrap in double quotes:

{
"{{to_email}}":{"ref_id":"{{referenceid_variable}}"}
}

Seems counter intuitive, especially when dealing with numbers, but it does work…

Sadly not because there’s no data binder for the group name.

Thanks, I’m getting a bit closer, but its behaviour is very weird.
Right now this is what I put:

{
  "{{to_email}}":{"ref_id":"{{ref_id_var}}"}
}

And this is the result:
image

The wappler UI does recognise them as blue variables: image

return { [to_email] : {"ref_id":ref_id} }

image

Safari 27-01-2023 20.40.38 000222@2x

LMAO just realized I pasted the wrong gif :joy::joy:
That one was meant for a whatsapp group :joy:

Anyway, it can stay as it’s even funnier than the one I meant to paste.

1 Like

:rofl::rofl::rofl::rofl:
(And I thought: yeah, finally someone with my type of humor )

1 Like

You will find a lot of those around the forum. Sometimes I wonder how I am not banned yet :joy:

3 Likes

image

3 Likes

There is only one plausible explanation. I’m the second account of @Teodor

image

3 Likes

Hahaha I deserved the gif.
After asking it I tried and realised this is very very basic.

So I’ll take Jesse’s loving words in exchange for wasting a few minutes of your time.

Appreciate it though…!