apoc.map.fromLists

This function is deprecated. Use Cypher’s map comprehension instead.

Details

Syntax

apoc.map.fromLists(keys, values)

Description

Creates a MAP from the keys and values in the given LIST<ANY> values.

Arguments

Name

Type

Description

keys

LIST<STRING>

A list of keys to create a map from.

values

LIST<ANY>

A list of values associated with the keys to create a map from.

Returns

MAP

Usage examples

The following creates a MAP from keys and values lists:

apoc.map.fromLists
RETURN apoc.map.fromLists(
    ["name", "dob"],
    ["Cristiano Ronaldo", date("1985-02-05")]
) AS output;
Cypher’s Map Comprehension
WITH ["name", "dob"] AS keys,
     ["Cristiano Ronaldo", date("1985-02-05")] AS values
RETURN { i IN range(0, size(keys) - 1) | keys[i]: values[i] } AS output
Results
output
{
  "name": "Cristiano Ronaldo",
  "dob": "1985-02-05"
}