JSON_VALID
Syntax
JSON_VALID(value)
Contents
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.
From MariaDB 10.4.3, the JSON_VALID function is automatically used as a CHECK constraint for the JSON data type alias in order to ensure that a valid json document is inserted.
Examples
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 | +------------------------------------------------------+
See Also
- JSON video tutorial covering JSON_VALID.
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.