MariaDB starting with 10.2.3

JSON functions were added in MariaDB 10.2.3.

Syntax

JSON_TYPE(json_val)

Description

Returns the type of a JSON value, or NULL if the argument is null.

An error will occur if the argument is an invalid JSON value.

The following is a complete list of the possible return types:

Return typeValue
ARRAYJSON array
BITMariaDB BIT scalar
BLOBMariaDB binary types (BINARY, VARBINARY or BLOB)
BOOLEANJSON true/false literals
DATEMariaDB DATE scalar
DATETIMEMariaDB DATETIME or TIMESTAMP scalar
DECIMALMariaDB DECIMAL or NUMERIC scalar
DOUBLEMariaDB DOUBLE FLOAT scalar
INTEGERMariaDB integer types (TINYINT, SMALLINT, MEDIUMINT, INT or BIGINT)
NULLJSON null literal or NULL argument
OBJECTJSON object
OPAQUEAny valid JSON value that is not one of the other types.
STRINGMariaDB character types (CHAR, VARCHAR, TEXT, ENUM or SET)
TIMEMariaDB TIME scalar

Examples

SELECT JSON_TYPE('{"A": 1, "B": 2, "C": 3}');
+---------------------------------------+
| JSON_TYPE('{"A": 1, "B": 2, "C": 3}') |
+---------------------------------------+
| OBJECT                                |
+---------------------------------------+

Comments

Comments loading...
Loading