apoc.map.sortedProperties

Function

apoc.map.sortedProperties(map Map<String, Any>, ignoreCase Boolean) - returns a list of key/value pairs in a list. The pairs are sorted by alphabetically by key, with optional case sensitivity.

Signature

apoc.map.sortedProperties(map :: MAP?, ignoreCase = true :: BOOLEAN?) :: (LIST? OF ANY?)

Input parameters

Name Type Default

map

MAP?

null

ignoreCase

BOOLEAN?

true

Usage Examples

The following returns a list of key/value list pairs with pairs sorted by key alphabetically:

WITH {name:"Cristiano Ronaldo",country:"Portugal",dob:date("1985-02-05")} AS map
RETURN apoc.map.sortedProperties(map) AS output;
Table 1. Results
Output

[["country","Portugal"],["dob","1985-02-05"],["name","Cristiano Ronaldo"]]