> ## 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.

# Object: Keep matching keys

> Returns only the keys that exist in both the object and the supplied data.

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>;
};

Keeps only the entries of an object whose keys also appear in a second object you supply, and drops the rest. The values that are kept come from the input; the supplied data is used only to decide which keys are allowed. Use this to narrow an object down to a known set of fields, for example stripping an incoming product record down to just the handful of attributes your target system expects.

This documentation describes: [Schema](/schemas/mapper/list-intersect-keys)

## Fields

<FormField property="array" label="Array" required>
  The set of allowed keys, entered as JSON. Only the keys matter here, so the values you put against them can be anything. Any key in the input that is not listed here is removed.
</FormField>

## Sample data

| Field | Value                             |
| ----- | --------------------------------- |
| Array | `{ "color": true, "size": true }` |

Input:

```json theme={null}
{ "attributes": { "color": "red", "size": "M", "weight": "200g", "brand": "Acme" } }
```

Output:

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

Only the `color` and `size` keys are allowed, so `weight` and `brand` are removed. The kept values come from the input, not from the allowed set.

```json Configuration theme={null}
{
  "prototype": "list-intersect-keys",
  "parameters": {
    "array": {
      "color": true,
      "size": true
    }
  }
}
```
