apoc.convert.toSortedJsonMap

Function

apoc.convert.toSortedJsonMap(value ANY, ignoreCase BOOLEAN) - converts a serialized JSON object from the property of a given NODE into a Cypher MAP.

Signature

apoc.convert.toSortedJsonMap(value :: ANY, ignoreCase = true :: BOOLEAN) :: STRING

Input parameters

Name Type Default

value

ANY

null

ignoreCase

BOOLEAN

true

Usage examples

The following converts a map to a JSON map with keys sorted alphabetically, ignoring case sensitivity:

WITH {b:8, d:3, a:2, E: 12, C:9} as map
RETURN apoc.convert.toSortedJsonMap(map) as output;
Table 1. Results
Output

"{\"a\":2,\"b\":8,\"C\":9,\"d\":3,\"E\":12}"

The following converts a map to a JSON map with keys sorted alphabetically, with case sensitivity:

WITH {b:8, d:3, a:2, E: 12, C:9} as map
RETURN apoc.convert.toSortedJsonMap(map, false) as output;
Table 2. Results
Output

"{\"C\":9,\"E\":12,\"a\":2,\"b\":8,\"d\":3}"