---
title: "Combine keys with values"
slug: "combine-keys-with-values"
description: "Use the \"combine keys with values\" adapter to pair a separate headers array with row values so that each row becomes keyed by header name."
updated: 2026-06-04T07:44:18Z
published: 2026-06-04T07:44:18Z
canonical: "docs.supermetrics.com/combine-keys-with-values"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supermetrics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Combine keys with values

Some APIs split the column names and the row values into separate arrays — for example, a top-level `headers` array and a `rows` array where each row only has a `values` array. `combine_keys_with_values` pairs them up by position so each row becomes an object keyed by the header names.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `keysPath` | string | Yes | JSONPath to the array of header names. |
| `valuesPath` | string | Yes | JSONPath to the row value arrays, one per row. |
| `dataDestinationPath` | string | Yes | JSONPath where the resulting rows are written. |

Below you can find a before/after example:

```
{
  "headers": [
    "date",
    "metric.impressionCount"
  ],
  "rows": [
    {
      "values": [
        "2020-01-01",
        "645"
      ]
    },
    {
      "values": [
        "2020-01-02",
        "921"
      ]
    }
  ]
}
```

After the adapter runs, the row arrays are replaced with header-keyed objects:

```
{
  "headers": [
    "date",
    "metric.impressionCount"
  ],
  "rows": [
    {
      "date": "2020-01-01",
      "metric.impressionCount": "645"
    },
    {
      "date": "2020-01-02",
      "metric.impressionCount": "921"
    }
  ]
}
```

Configuration:

```
"response": {
  "dataRows": {
    "source": "jsonPath",
    "value": "$.rows.*"
  },
  "dataAdapters": {
    "items": [
      {
        "type": "combine_keys_with_values",
        "config": {
          "keysPath": "$.headers.*",
          "valuesPath": "$.rows.*.values",
          "dataDestinationPath": "$.rows"
        }
      }
    ]
  }
}
```

Below you can find example field definitions that read from the transformed structure:

```
[
  {
    "id": "date",
    "label": "Date",
    "dataType": "string.time.date",
    "value": {
      "source": "jsonPath",
      "value": "$.date"
    }
  },
  {
    "id": "impression_count",
    "label": "Impression count",
    "dataType": "int.number.value",
    "value": {
      "source": "jsonPath",
      "value": "$['metric.impressionCount']"
    }
  }
]
```
