keys

This function returns the distinct keys of all objects in the supplied sequence, in an implementation-dependent order.

keys($o as item*) as string*

Example 181. Getting all distinct key names in the supplied objects, ignoring non-objects.

let $o := ("foo", [ 1, 2, 3 ], { "a" : 1, "b" : 2 }, { "a" : 3, "c" : 4 })
return keys($o)
        

Result (run with Zorba): a b c


Example 182. Retrieving all Pairs from an Object:

let $map := { "eyes" : "blue", "hair" : "fuchsia" }
for $key in keys($map)
return { $key : $map.$key }
        

Result (run with Zorba): { "eyes" : "blue" } { "hair" : "fuchsia" }