JS outside of a string

Hi, I’m running into an issue when trying to setup my Action’s json file. I’d like to execute builtin functions outside of a string, however when I use the mustache syntax outside of the string I get an error (Property expected). Below is what I’d like to accomplish (parts omitted for brevity):

{
  "body": {
    "users": [
      {{if(parameters.email, {"email": parameters.email}, null)}}
    ]
  }
}

however I end up needing to do "{{if(parameters.email... which results in users being an array of strings instead of objects. Any help would be appreciated!

Just wanted to follow up that I was able to get it working! What I ended up doing was:

"users": "{{parseJSON(if(parameters.email; '[{\"email\":\"' + parameters.email + '\"}]'; '[]'))}}"
4 Likes

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