IS_ARRAY
Checks if the input value is a JSON array. Please note that a JSON array is not the same as the ARRAY data type. A JSON array is a data structure commonly used in JSON, representing an ordered collection of values enclosed within square brackets [ ]
. It is a flexible format for organizing and exchanging various data types, including strings, numbers, booleans, objects, and nulls.
[
"Apple",
42,
true,
{"name": "John", "age": 30, "isStudent": false},
[1, 2, 3],
null
]
Analyze Syntax
func.is_array(<expr>)
Analyze Example
func.is_array(func.parse_json('true')), func.is_array(func.parse_json('[1,2,3]'))
┌────────────────────────────────────────────────────────────────────────────────────┐
│ func.is_array(func.parse_json('true')) │ func.is_array(func.parse_json('[1,2,3]')) │
├────────────────────────────────────────┼───────────────────────────────────────────┤
│ false │ true │
└────────────────────────────────────────────────────────────────────────────────────┘
SQL Syntax
IS_ARRAY( <expr> )
Return Type
Returns true
if the input value is a JSON array, and false
otherwise.
SQL Examples
SELECT
IS_ARRAY(PARSE_JSON('true')),
IS_ARRAY(PARSE_JSON('[1,2,3]'));
┌────────────────────────────────────────────────────────────────┐
│ is_array(parse_json('true')) │ is_array(parse_json('[1,2,3]')) │
├──────────────────────────────┼─────────────────────────────────┤
│ false │ true │
└────────────────────────────────────────────────────────────────┘
Last modified June 12, 2024 at 4:51 PM EST: adding JSON method updates (a7607f7)