json_object_keys
function
Applies to: Databricks SQL Databricks Runtime
Returns all the keys of the outermost JSON object as an array.
Syntax
json_object_keys(jsonObject)
Arguments
jsonObject
: A STRING expression of a valid JSON array format.
Returns
An ARRAY < STRING >.
If ‘jsonObject’ is any other valid JSON string, an invalid JSON string or an empty string, the function returns NULL.
Examples
> SELECT json_object_keys('{}');
[]
> SELECT json_object_keys('{"key": "value"}');
[key]
> SELECT json_object_keys('{"f1":"abc","f2":{"f3":"a", "f4":"b"}}');
[f1,f2]
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for