object_keys
Returns an array containing the list of keys in the top-most level of the input object.
Syntax
Section titled “Syntax”object_keys( <object> )
Arguments
Section titled “Arguments”<object>
Section titled “<object>”The value for which you want the keys. The input value must be A variant that contains a value of type OBJECT.
Returns
Section titled “Returns”The function returns an ARRAY containing the keys.
Examples
Section titled “Examples”Retrieve the keys from a variant:
SELECT object_keys({"a": 1, "b": 2, "c": 3}) as keys;
+---------------+| keys |+---------------+| ['a','b','c'] |+---------------+
Only the top-most level keys are returned:
SELECT object_keys (parse_json ('{"level_1_A": {"level_2": "two"},"level_1_B": "one"}')) AS keys;
+---------------------------+| keys |+---------------------------+| ['level_1_A','level_1_B'] |+---------------------------+