JSON_CONTAINS_PATH
Check for a JSON path. This function returns 1 if a specified path exists within a JSON document, or 0 if it does not.
Syntax
JSON_CONTAINS_PATH(json_doc, return_arg, path[, path] ...)Description
Examples
SET @json = '{"A": 1, "B": [2], "C": [3, 4]}';
SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D');
+------------------------------------------------+
| JSON_CONTAINS_PATH(@json, 'one', '$.A', '$.D') |
+------------------------------------------------+
| 1 |
+------------------------------------------------+
1 row in set (0.00 sec)
SELECT JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D');
+------------------------------------------------+
| JSON_CONTAINS_PATH(@json, 'all', '$.A', '$.D') |
+------------------------------------------------+
| 0 |
+------------------------------------------------+Last updated
Was this helpful?

