W3cubDocs

/MariaDB

JSON_TYPE

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 type Value
ARRAY JSON array
BIT MariaDB BIT scalar
BLOB MariaDB binary types (BINARY, VARBINARY or BLOB)
BOOLEAN JSON true/false literals
DATE MariaDB DATE scalar
DATETIME MariaDB DATETIME or TIMESTAMP scalar
DECIMAL MariaDB DECIMAL or NUMERIC scalar
DOUBLE MariaDB DOUBLE FLOAT scalar
INTEGER MariaDB integer types (TINYINT, SMALLINT, MEDIUMINT, INT or BIGINT)
NULL JSON null literal or NULL argument
OBJECT JSON object
OPAQUE Any valid JSON value that is not one of the other types.
STRING MariaDB character types (CHAR, VARCHAR, TEXT, ENUM or SET)
TIME MariaDB TIME scalar

Examples

SELECT JSON_TYPE('{"A": 1, "B": 2, "C": 3}');
+---------------------------------------+
| JSON_TYPE('{"A": 1, "B": 2, "C": 3}') |
+---------------------------------------+
| OBJECT                                |
+---------------------------------------+
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/json_type/