All pages
Powered by GitBook
1 of 1

Loading...

JSON_VALID

Check if a value is valid JSON. This function returns 1 if the argument is a valid JSON document, and 0 otherwise.

Syntax

Description

Indicates whether the given value is a valid JSON document or not. Returns 1 if valid, 0 if not, and NULL if the argument is NULL.

The JSON_VALID function is automatically used as a for the in order to ensure that a valid json document is inserted.

The JSON_VALID function is not automatically used as a for the .

Examples

See Also

  • covering JSON_VALID.

This page is licensed: CC BY-SA / Gnu FDL

JSON_VALID(value)
CHECK constraint
JSON data type alias
CHECK constraint
JSON data type alias
JSON video tutorial
SELECT JSON_VALID('{"id": 1, "name": "Monty"}');
+------------------------------------------+
| JSON_VALID('{"id": 1, "name": "Monty"}') |
+------------------------------------------+
|                                        1 |
+------------------------------------------+

SELECT JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}');
+------------------------------------------------------+
| JSON_VALID('{"id": 1, "name": "Monty", "oddfield"}') |
+------------------------------------------------------+
|                                                    0 |
+------------------------------------------------------+