Comments - JSON_EXISTS

3 years, 3 months ago Olivier Bertrand

Now I see. The description of this function and the given examples are misleading. This function does not say that a particular value (for instance "b") exist in the array or document, but that the path given as the second argument points to an existing item. For instance:

SELECT JSON_EXISTS('{"key1":"xxxx", "key2":["a", "b", "c"]}', '$.key2[1]');

Actually returns 1. As it is, this function has almost no interest because the JSON_VALUE function gives the same information (a value or NULL instead of 1 or 0)

 
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.