top of page
CerebroSQL

MySQL: 

JSON_VALID

Syntax:
JSON_VALID(val)

Returns 0 or 1 to indicate whether a value is valid JSON. Returns NULL
if the argument is NULL.

URL: https://dev.mysql.com/doc/refman/8.0/en/json-attribute-functions.html

Example

mysql> SELECT JSON_VALID('{"a": 1}');
+------------------------+
| JSON_VALID('{"a": 1}') |
+------------------------+
| 1 |
+------------------------+
mysql> SELECT JSON_VALID('hello'), JSON_VALID('"hello"');
+---------------------+-----------------------+
| JSON_VALID('hello') | JSON_VALID('"hello"') |
+---------------------+-----------------------+
| 0 | 1 |
+---------------------+-----------------------+

bottom of page