---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, PMD Scripting, Scripts]
nav: wcp_docs
parent_url: /wcp_docs/
title: createMapListWithKeys (list, keyList)
layout: subsection
---

## <a id="section_m3p_myb_5db"></a>Description

Transforms a list of values and returns a mapped list of key/value pairs using a given list of keys. The number of values must match the number of keys. If both input lists have different sizes, `createMapListWithKeys` returns an empty map.

`createMapListWithKeys` is useful for transforming raw data into objects.

## <a id="section_cyq_j1m_zsb"></a>Return Type

`List`

## <a id="section_dz5_pwg_5db"></a>Namespace Function Syntax

```
list:createMapListWithKeys(list, keyList)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>list</td><td>An array of values</td></tr><tr><td>keyList</td><td>An array of keys to use in the transformed list. The number of keys in <code>keyList</code> must match the number of values in <code>list</code>.</td></tr></tbody></table><br/>

<b>Example</b>

Assume:

-   <i>theList</i> is <i>['my', 'list']</i>.
-   <i>theKeyList</i> is <i>['key1', 'key2']</i>.


`list:createMapListWithKeys(theList, theKeyList)`

Returns `[{'key1': 'my'}, {'key2': 'list'}]`

