JSONata array lookup using msg property

The trouble I have using JSONata once a year is that I can never work out the syntax required

image

msg.random contains number 0..2

How can I pick out the corresponding colour from the array?

Currently getting undefined

Try [1,2,3][$$.random]

1 Like

Thank you
image

I MUST TRY TO REMEMBER ABOUT $$. !!!!

I have taken to using $$ when referencing msg properties, as a fail safe to what ever scope the expression is in.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.