Hi there, I’m trying to substitute an array into JSON through the Octopus Variable. I’m seeing that Arrays are supported but it seems like it won’t substitute a group of values as an array.
This is what I’m trying to do.
A note about an edge case I discovered that is not explicitly mentioned in the documentation. The replaced value MUST be an array already, otherwise JSON Variable Replacement replaces the variable as a string.
I originally had:
{
"AllowedOrigins": null
}
And variable:
AllowedOrigins: ["Value1", "Value2"]
The replaced file ended up with:
{
"AllowedOrigins": "[\"Value1\", \"Value2\"]"
}
The workaround was to explicitly “declare” the empty array:
{
"AllowedOrigins": []
}
This is a bit unfortunate since the consuming code may have different interpretations of an empty array versus a missing array.