Skip to main content
Version: V1.0.0

JSON_ARRAY

Description

This function returns a JSON array containing the input values, which can be empty.

Syntax

JSON_ARRAY([val[, val] ...])

Parameters

The val parameter specifies the input value.

Examples

SELECT JSON_ARRAY(1, "abcd", NULL, TRUE, CURTIME(),'[a,b,c]','{"d":100}');
+---------------------------------------------------------------------+
| JSON_ARRAY(1, "abcd", NULL, TRUE, CURTIME(),'[a,b,c]','{"d":100}') |
+---------------------------------------------------------------------+
| [1, "abcd", null, true, "21:49:37.000000", "[a,b,c]", "{\"d\":100}"] |
+---------------------------------------------------------------------+
1 row in set (0.001 sec)

SELECT JSON_ARRAY(NULL);
+------------------+
| JSON_ARRAY(NULL) |
+------------------+
| [null] |
+------------------+
1 row in set (0.001 sec)

SELECT JSON_ARRAY();
+--------------+
| JSON_ARRAY() |
+--------------+
| [] |
+--------------+
1 row in set (0.001 sec)