apoc.map.fromPairs

Function APOC Core

apoc.map.fromPairs([[key,value],[key2,value2],…​])

Signature

apoc.map.fromPairs(pairs :: LIST? OF LIST? OF ANY?) :: (MAP?)

Input parameters

Name Type Default

pairs

LIST? OF LIST? OF 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"
}