Transform array with keys and values to key-value object.
Use cases
You have data in the following format:
[
{
"key": "key1",
"value": "value1"
},
{
"key": "key2",
"value": "value2"
}
]
And you need to transform it to the following:
{
"key1": "value1",
"key2": "value2"
}
Workflow YAML
- name: Array to Object Action
uses: faradaytrs/[email protected]
with:
# Array to transform
data: ${{ toJSON(myArray) }}
# Key property in array
keyProperty: key
# Value property in array
valueProperty: value
# Output name, defaults to "data"
output: data