Skip to main content
Version: V1.0.0

JSON_VALID

Description

This function returns 1 if the input value is valid JSON, and 0 otherwise.

Syntax

JSON_VALID(val)

Description

The val parameter specifies the input value. If val is NULL, the function returns NULL.

Examples

SELECT JSON_VALID('{"a": 1}');
+------------------------+
| JSON_VALID('{"a": 1}') |
+------------------------+
| 1 |
+------------------------+
1 row in set (0.001 sec)

SELECT JSON_VALID('oceanbase'), JSON_VALID('"oceanbase"');
+-------------------------+---------------------------+
| JSON_VALID('oceanbase') | JSON_VALID('"oceanbase"') |
+-------------------------+---------------------------+
| 0 | 1 |
+-------------------------+---------------------------+
1 row in set (0.001 sec)