Skip to content

Array to object action

Actions
Transform array with data to key-value object
0.2
LatestPre-release
Star (3)

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

Array to object action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Transform array with data to key-value object
0.2
LatestPre-release

Array to object action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.