Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

JSON_ARRAY_LENGTH Function

JSON_ARRAY_LENGTH returns the number of elements in the outer array of a JSON string.

For more information, see JSON Functions.

Syntax

Copy
json_array_length('json_array')

Arguments

json_array

A properly formatted JSON array.

Return Type

An integer representing the number of elements in the outermost array.

Example

The following example returns the number of elements in the array:

Copy
select json_array_length('[11,12,13,{"f1":21,"f2":[25,26]},14]'); json_array_length ----------------- 5