In MariaDB, JSON_REMOVE() is a built-in function that removes data from a JSON document and returns the result.
json
MariaDB JSON_QUOTE() Explained
In MariaDB, JSON_QUOTE() is a built-in function that produces a valid JSON string literal that can be included in a JSON document.
It wraps the string with double quote characters and escapes interior quotes and other special characters, returning a utf8mb4 string.
MariaDB JSON_LOOSE() Explained
In MariaDB, JSON_LOOSE() is a built-in function that adds spaces to a JSON document to make it more readable.
It’s similar to the JSON_DETAILED() function, except that it doesn’t emphasise nested structures in the way that JSON_DETAILED() does.
For the opposite effect (i.e. to remove unnecessary spaces), use the JSON_COMPACT() function.
MariaDB JSON_LENGTH() Explained
In MariaDB, JSON_LENGTH() is a built-in function that returns the length of a JSON document.
When you call this function, you provide the JSON document as an argument. You can also provide a path argument to return the length of a value within the document.
MariaDB JSON_KEYS() Explained
In MariaDB, JSON_KEYS() is a built-in function that returns an array of the top-level keys from a JSON document. If a path is provided, it returns the top-level keys from that path.
It excludes keys from nested sub-objects in the specified level.
Also, if the selected object is empty, an empty array is returned.
MariaDB JSON_SET() Explained
In MariaDB, JSON_SET() is a built-in function that updates or inserts data into a JSON document and returns the result.
JSON_SET() can update and insert data, whereas JSON_INSERT() can only insert data, and JSON_REPLACE() can only update data.
MariaDB JSON_REPLACE() Explained
In MariaDB, JSON_REPLACE() is a built-in function that replaces existing values in a JSON document and returns the result.
MariaDB JSON_INSERT() Explained
In MariaDB, JSON_INSERT() is a built-in function that inserts data into a JSON document, and returns the result.
MariaDB JSON_DEPTH() Explained
In MariaDB, JSON_DEPTH() is a built-in function that allows you to check the depth of a JSON document.
It accepts the JSON document as an argument, and returns the maximum depth of the document.
MariaDB JSON_EXISTS() Explained
In MariaDB, JSON_EXISTS() is a built-in function that allows you to check whether a value exists at a specified path in the JSON document.
It accepts the JSON document as an argument, and returns 1 if the path is found, and 0 if it’s not.
The MariaDB documentation states that the function “determines whether a specified JSON value exists in the given data”. However, the function doesn’t actually appear to check for a given value. It’s probably more accurate to say that it determines whether a specified path exists, or that a value exists at the specified path.
For checking that the actual value exists, you can use the JSON_CONTAINS() function.