---
title: MAP_LAMBDA
url: https://www.tines.com/docs/formulas/functions/map-lambda/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# MAP_LAMBDA

*[View on tines.com](https://www.tines.com/docs/formulas/functions/map-lambda/)*

Return an array that is the result of calling lambda with each element of the input array or each key-value pair of the input object.

**Categories:** Lambdas

## Syntax

```
MAP_LAMBDA(array_or_object, lambda)
```

## Examples

### Example 1: Construct an array of elements from input array.

Input:

```json
{
  "my_action": {
    "email_array": [
      "foo@tines.com",
      "bar@tines.com"
    ]
  }
}
```

Formula:

```
MAP_LAMBDA(my_action.email_array, LAMBDA(elem, OBJECT("email_address", OBJECT("address", elem))))
```

Output:

```json
[
  {
    "email_address": {
      "address": "foo@tines.io"
    }
  },
  {
    "email_address": {
      "address": "bar@tines.io"
    }
  }
]
```

### Example 2: Construct an array of elements from input object.

Input:

```json
{
  "my_action": {
    "my_object": {
      "foo": [
        1,
        2,
        3
      ],
      "baz": [
        4,
        5,
        6
      ]
    }
  }
}
```

Formula:

```
MAP_LAMBDA(my_action.my_object, LAMBDA(key, value, OBJECT("key", key, "sum", SUM(value))))
```

Output:

```json
[
  {
    "key": "foo",
    "sum": 6
  },
  {
    "key": "baz",
    "sum": 15
  }
]
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "2",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "email_array": [
            "foo@tines.com",
            "bar@tines.com"
          ]
        }
      },
      "position": {
        "x": 2235,
        "y": 3225
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "MAP_LAMBDA",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "map_lambda": "=MAP_LAMBDA(my_action.email_array, LAMBDA(elem, OBJECT(\"email_address\", OBJECT(\"address\", elem))))\n"
        }
      },
      "position": {
        "x": 2235,
        "y": 3330
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
