content_image/864341.jpg
+-----------------+ 

An error occurs if the argument is not a valid JSON value: 

mysql> SELECT JSON_TYPE(1); ERROR 3146 (22032): Invalid data type for JSON data in argument 1 to function json_type; a JSON string or JSON type is required. 

For a non- NULL , non-error result, the following list describes the possible JSON_TYPE()  return values: 

•Purely JSON types: 

• OBJECT : JSON objects 

• ARRAY : JSON arrays 

• BOOLEAN : The JSON true and false literals 

• NULL : The JSON null literal 

•Numeric types: 

• INTEGER : MySQL TINYINT , SMALLINT , MEDIUMINT  and INT  and BIGINT  scalars 

• DOUBLE : MySQL DOUBLE FLOAT  scalars 

• DECIMAL : MySQL DECIMAL  and NUMERIC  scalars 

•Temporal types: 

• DATETIME : MySQL DATETIME  and TIMESTAMP  scalars 

• DATE : MySQL DATE  scalars 

• TIME : MySQL TIME  scalars 

•String types: 

• STRING : MySQL utf8  character type scalars: CHAR , VARCHAR , TEXT , ENUM , and SET 

•Binary types: 

• BLOB : MySQL binary type scalars including BINARY , VARBINARY , BLOB , and BIT 

•All other types: 

• OPAQUE  (raw bits) 

• JSON_VALID( val ) 

Returns 0 or 1 to indicate whether a value is valid JSON. Returns NULL  if the argument is NULL . 

mysql> SELECT JSON_VALID(’{"a": 1}’); 

<img src='content_image/864341.jpg'>

SELECT JSON_VALID(’hello’), JSON_VALID(’"hello"’); 

+---------------------+-----------------------+ 

