All Products
Search
Document Center

MaxCompute:JSON_ARRAY

Last Updated:Mar 26, 2026

Constructs a JSON array from zero or more values.

Syntax

json json_array(<element>)

Parameters

Parameter Required Supported types
element Yes STRING, BIGINT, BOOLEAN, JSON

Pass one or more values as separate arguments. To create an empty array, call the function with no arguments.

Return value

Returns a value of the JSON type.

Examples

Empty array

SELECT json_array();

Result:

+-----+
| _c0 |
+-----+
| []  |
+-----+

Mixed types

SELECT json_array('a', 45, true, 13, json '{"a":456}');

Result:

+-----+
| _c0 |
+-----+
| ["a",45,true,13,{"a":456}] |
+-----+

Related functions

JSON_ARRAY is a complex type function. For more information about functions that process complex types such as ARRAY, MAP, STRUCT, and JSON, see Complex type functions.