All Products
Search
Document Center

MaxCompute:JSON_ARRAY

Last Updated:Jul 28, 2023

Generates a JSON array. This function converts a list of values into a JSON array that contains the values. The input list can be empty.

Syntax

json json_array(<element>)

Parameters

element: required. The values in the list specified by this parameter must be of the STRING, BIGINT, BOOLEAN, or JSON type.

Return value

The return value is of the JSON type.

Examples

-- Generate a JSON array.
select json_array('a', 45, true, 13, json '{"a":456}');

The following result is returned:

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

Related functions

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