Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
JSON_ GET_ TYPE
On this page
The JSON_ function returns the JavaScript type of the given JSON object.
Syntax
JSON_GET_TYPE(json)
Arguments
-
json: a valid JSON value.
Return Value
The type is returned as one of the following strings:
-
boolean
-
double
-
string
-
array
-
object
-
null
-
Or, SQL NULL if json is not a valid JSON object.
Examples
SELECT JSON_GET_TYPE('true');
+-----------------------+
| json_get_type('true') |
+-----------------------+
| boolean |
+-----------------------+SELECT JSON_GET_TYPE('12345');
+------------------------+
| JSON_GET_TYPE('12345') |
+------------------------+
| double |
+------------------------+SELECT JSON_GET_TYPE('"alpha, beta, gamma"');
+---------------------------------------+
| JSON_GET_TYPE('"alpha, beta, gamma"') |
+---------------------------------------+
| string |
+---------------------------------------+SELECT JSON_GET_TYPE('[1,2,3]');
+--------------------------+
| JSON_GET_TYPE('[1,2,3]') |
+--------------------------+
| array |
+--------------------------+SELECT JSON_GET_TYPE('{"alpha”:1, "beta”:2}’);
+----------------------------------------+
| JSON_GET_TYPE('{"alpha":1, "beta":2}') |
+----------------------------------------+
| object |
+----------------------------------------+SELECT JSON_GET_TYPE('null');
+-----------------------+
| JSON_GET_TYPE('null') |
+-----------------------+
| null |
+-----------------------+Note
A JSON or Javascript null value is distinct from SQL NULL.
Last modified: