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

# Array or object: Merge

> Merges the supplied data into the array or object. Existing keys are overwritten.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Use this mapper to combine the input with a set of data you supply, producing a single merged result. Where both sides share the same key, the value you supply wins and replaces the one from the input; keys that exist on only one side are kept as they are. The merge also reaches into nested objects, so you can update a field deep inside a structure without rewriting the whole thing. This is handy for adding fixed defaults or overriding a few fields on every record.

This documentation describes: [Schema](/schemas/mapper/list-extend-with)

## Fields

<FormField property="array" label="Data" required>
  The data to merge in, entered directly as a small block of data in the form. Any key it shares with the input overwrites the input's value; any new key is added. The merge applies at every level, including nested objects.
</FormField>

## Sample data

This example overrides one attribute and adds a new one on a product's attributes.

| Field | Value                                 |
| ----- | ------------------------------------- |
| Data  | `{ "size": "L", "material": "wool" }` |

Input:

```json theme={null}
{
    "color": "red",
    "size": "M"
}
```

Output:

```json theme={null}
{
    "color": "red",
    "size": "L",
    "material": "wool"
}
```

The `size` value is overwritten with `L`, the new `material` field is added, and `color` is left untouched.

```json Configuration theme={null}
{
  "prototype": "list-extend-with",
  "parameters": {
    "array": { "size": "L", "material": "wool" }
  }
}
```
