Skip to main content

Description

Converts a list of key-value pairs into a map. Each pair should be a two-element array [key, value].

Syntax

Parameters

Returns

Type: map (object) A map where each key-value pair from the input list becomes a property. Returns an empty map if input is not an array.

Examples

Example 1: Basic Conversion

Output:

Example 2: Converting Zipped Data

Output:

Example 3: Dynamic Property Creation

Example 4: Converting Query Results to Lookup Map

Notes

  • Returns empty map if input is not an array or is null
  • Each pair must be a two-element array; invalid pairs are skipped
  • If a key is null or undefined, the pair is ignored
  • Duplicate keys result in the last value being used
  • Keys are converted to strings as map property names

See Also

Frequently Asked Questions

It expects a list of two-element lists (pairs) where the first element is the key and the second is the value: [['key1', 'val1'], ['key2', 'val2']].
Later pairs overwrite earlier ones — the last value for a given key wins.