json_array_length
function
Applies to: Databricks SQL Databricks Runtime
Returns the number of elements in the outermost JSON array.
Syntax
json_array_length(jsonArray)
Arguments
jsonArray
: A JSON array.
Returns
An INTEGER.
The function returns NULL if jsonArray
is not a valid JSON string or NULL
.
Examples
> SELECT json_array_length('[1,2,3,4]');
4
> SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');
5
> SELECT json_array_length('[1,2');
NULL
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