Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 713 Bytes

readme.md

File metadata and controls

49 lines (37 loc) · 713 Bytes

Transform array to key-value object

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