All Products
Search
Document Center

MaxCompute:JSON_TYPE

Last Updated:Mar 26, 2026

Returns the JSON type of a JSON value as a string.

Syntax

json_type(<json>)

Parameters

ParameterRequiredDescription
jsonYesThe JSON expression to evaluate.

Return value

Returns a STRING value. The possible values correspond to the six types defined in the JSON specification:

Return valueDescription
stringThe JSON value is a string.
numberThe JSON value is a number.
booleanThe JSON value is true or false.
nullThe JSON value is null.
objectThe JSON value is an object (key-value pairs enclosed in {}).
arrayThe JSON value is an array (values enclosed in []).

Examples

Return array for a JSON array:

SELECT json_type(json '[{"a":1}, 23]');
+-------+
| _c0   |
+-------+
| array |
+-------+

Return number for a JSON number:

SELECT json_type(json '123');
+--------+
| _c0    |
+--------+
| number |
+--------+

Return string for a JSON string:

SELECT json_type(json '"123"');
+--------+
| _c0    |
+--------+
| string |
+--------+

Related functions

JSON_TYPE is a complex type function. For more information about functions for processing ARRAY, MAP, STRUCT, and JSON data types, see Complex type functions.