apoc.map.fromPairs

Function

apoc.map.fromPairs(pairs LIST<LIST<key ANY, value ANY>>) - creates a MAP from the given LIST<LIST<ANY>> of key-value pairs.

Signature

apoc.map.fromPairs(pairs :: LIST<LIST<ANY>>) :: MAP

Input parameters

Name Type Default

pairs

LIST<LIST<ANY>>

null

Usage Examples

The following creates a MAP from list of key-value pairs:

RETURN apoc.map.fromPairs([
    ["name", "Cristiano Ronaldo"],
    ["age", date("1985-02-05")]
]) AS output;
Table 1. Results
Output
{
  "name": "Cristiano Ronaldo",
  "age": "1985-02-05"
}