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

# Data transformation

When you run a request, Data Fetcher converts the API response into a table of fields and records that can be written to your destination Airtable table. You can control how this data is structured using **response field mapping** and **data transformation** settings.

## Understanding the two transformation types

Data Fetcher offers two ways to handle nested arrays in your API responses: **Single record per item** and **Expand nested items**. The key difference is whether nested arrays stay **combined in one record** or are **expanded into multiple records**.

Let's use this sample JSON response to illustrate both approaches:

```json theme={null}
[
  {
    "id": "company1",
    "positions": [{ "id": "position1" }, { "id": "position2" }]
  },
  {
    "id": "company2",
    "positions": [{ "id": "position3" }, { "id": "position4" }]
  }
]
```

### Single record per item

**Single record per item** keeps each parent entity in one row by combining nested values with commas. Each company stays in its own record:

| **Id**   | **Positions id**    |
| -------- | ------------------- |
| company1 | position1,position2 |
| company2 | position3,position4 |

<Info>
  **Single record per item** doesn't mean the entire response becomes one record.

  Data Fetcher finds the **first array in the response** and creates **one record for each item in that array**.
</Info>

### Expand nested items

**Expand nested items** creates a new record for each item in a nested array. Parent fields are duplicated so each nested item has its own row.

| **Id**   | **Positions id** |
| -------- | ---------------- |
| company1 | position1        |
| company1 | position2        |
| company2 | position3        |
| company2 | position4        |

## How to set the transformation mode

1. On the create screen, open **Advanced settings**.
2. Under **Data Transformation**, select either **Single record per item** or **Expand nested items**.

<video controls className="w-full aspect-video rounded-xl" src="https://mintcdn.com/datafetcher/Om6mp4oJbINRDy9w/videos/Response%20data%20transformation.mp4?fit=max&auto=format&n=Om6mp4oJbINRDy9w&q=85&s=4436202669716f79b88b2aa4ae745fd9" data-path="videos/Response data transformation.mp4" />

## Advanced Single record per item options

### Combine nested object keys

By default, nested object values are combined into a **comma-separated field**. Using our example above, all `positions.id` values become a single-line text field called **Positions id**.

You can disable this to create separate numbered fields instead:

| **Id**   | **Positions 1 id** | **Positions 2 id** |
| -------- | ------------------ | ------------------ |
| company1 | position1          | position2          |
| company2 | position3          | position4          |

**To disable combining nested object keys:**

1. In advanced settings, ensure transformation is set to **Single record per item.**
2. Turn off **Combine nested object keys**.

### Combine arrays of text/numbers

Similarly, arrays of text or numbers are combined into a **comma-separated value** by default. For this response:

```json theme={null}
[
  {
    "id": "company1",
    "categories": ["Fintech", "Startup"]
  },
  {
    "id": "company2",
    "categories": ["Healthtech", "Public", "Unicorn"]
  }
]
```

The default output combines categories:

| **Id**   | **Categories**            |
| -------- | ------------------------- |
| company1 | Fintech,Startup           |
| company2 | Healthtech,Public,Unicorn |

You can disable this to create separate numbered fields:

**To disable combining arrays:**

1. In advanced settings, ensure transformation is set to **Single record per item.**
2. Turn off **Combine arrays of text/numbers.**

### Custom separators

Instead of commas, you can specify a custom separator for combined values. This is useful if your data **already contains commas** and you need a different delimiter such as the pipe symbol (`|`).

Both **Combine nested object keys** and **Combine arrays of text/numbers** use the separator you specify in the **Separator** input field.

**Need More Control?**

For more advanced control over how your response is structured, you can use a [response JMESPath](/advanced-options/response-jmespath) to customize exactly how the data is extracted and transformed.
