Syntax JSON Function

Hello Guys

Once again I get some problems with the function-syntax. I would like to specify the options for the dropdown node with using variable. (See photo)

Can you give me a tip?

Thanks a lot!

The property name should not be in quotes to create the object. You can stringify the object or define as a string.

In the Line 3, it looks like you are trying to make an array of objects where the objects key is from global context.

This is a JavaScript thing - to use a variable value as a key name in an object, you must surround it with [ ]


var keyName = "abc"
var value = 123
var newObj = { [keyName] : value }
// makes  { "abc" : 123 }

Exactly what i need, thanks!

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