I have a module whichs body is defined like below. But now “values” is added twice. What do i need to change to have not values projected in the first line but only once with the ToCollection conversion below?
In your current setup, values is appearing twice because {{...}}: "{{parameters}}" expands all key-value pairs from parameters, which includes values. Then, you’re explicitly adding values again with toCollection.
Solution:
To avoid values appearing twice, exclude it from the initial expansion. Make sure that parameters doesn’t directly output values. Instead, define the body like this:
“body”: {
“{{remove(parameters; ‘Values’)}}”: “{{parameters}}”,
“values”: “{{toCollection(parameters.Values;‘key’;‘value’)}}”
}