How to set a dynamic property name in a JSON object

Hi @patrick,

I am trying to set a dynamic property name in a JSON object but the {{}} substitution does not happen. This is an example of the JSON object:

{
“$set”: {
“index_history.0.execution_time”: “{{execution_time}}”
}
}

The “0” in “index_history.0.execution_time” is dynamic as it references the element index in an array in a MongoDB collection record. I have successfully used “Set Value” to create a variable with the value “index_history.0.execution_time” and used it in the JSON object like so:

{
   "$set": {
          "{{index_history_property_name}}": "{{execution_time}}"
   }

}

“index_history_property_name” is the name of the “Set Value” but the value of the variable does not get substituted into the JSON object. The property value “execution_time” does get substituted.

How can I dynamically set a property name in a JSON object?

Thanks
Allan