Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Returns the Javascript type of the given JSON object.
JSON_GET_TYPE(json)
The type is returned as one of the following strings:
SELECT JSON_GET_TYPE('true');
+-----------------------+
| json_get_type('true') |
+-----------------------+
| boolean |
+-----------------------+
SELECT JSON_GET_TYPE('12345');
+------------------------+
| JSON_GET_TYPE('12345') |
+------------------------+
| double |
+------------------------+
SELECT JSON_GET_TYPE('"ohai"');
+-------------------------+
| JSON_GET_TYPE('"ohai"') |
+-------------------------+
| string |
+-------------------------+
SELECT JSON_GET_TYPE('[1,2,3]');
+--------------------------+
| JSON_GET_TYPE('[1,2,3]') |
+--------------------------+
| array |
+--------------------------+
SELECT JSON_GET_TYPE('{"a":1, "b":2}');
+---------------------------------+
| JSON_GET_TYPE('{"a":1, "b":2}') |
+---------------------------------+
| object |
+---------------------------------+
SELECT JSON_GET_TYPE('null');
+-----------------------+
| JSON_GET_TYPE('null') |
+-----------------------+
| null |
+-----------------------+
A JSON or Javascript null value is distinct from SQL NULL.