# FLATTEN

### Description

`FLATTEN` extracts either one or more keys from a dictionary. When extracting only one key the result is a list, when extracting multiple the result is a list of dictionaries

### Example 1

```
FLATTEN(
  [
    {"key": "a", "name": "Thorben"},
    {"key": "b", "name": "Peter"},
    {"key": "c", "name": "Karin"},
    {"key": "d", "name": "Karl"},
  ],
  'key',
)
```

This returns a list of just the keys, so in this case `['a', 'b', 'c', 'd']`

### Example 2

```
FLATTEN(
  [
    {"key": "a", "name": "Karl", "age": 36},
    {"key": "b", "name": "Peter", "age": 26},
    {"key": "c", "name": "Karin", "age": 31},
  ],
  ["key", "name"]
)
```

This returns a list of dictionaries with just the mentioned the keys, so in this case

```
[
    {"key": "a", "name": "Karl"},
    {"key": "b", "name": "Peter"},
    {"key": "c", "name": "Karin"},
]
```

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/dictionary-operators/in-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
