In Oracle Database, the JSON_QUERY() function selects and returns one or more values from JSON data and returns those values.
You can use the function to retrieve fragments of a JSON document.
In Oracle Database, the JSON_QUERY() function selects and returns one or more values from JSON data and returns those values.
You can use the function to retrieve fragments of a JSON document.
In MariaDB, the JSON_VALUE() function and JSON_QUERY() function do similar things – they return data from a JSON document.
So what’s the difference?
The main difference is that JSON_VALUE() returns scalar values, whereas JSON_QUERY() returns arrays and objects.
Below is a list of the JSON functions available in MariaDB.
In MariaDB, JSON_VALID() is a built-in function that allows you to check whether or not a value is a valid JSON document.
You pass the value as an argument, and JSON_VALID() returns 1 if it’s a valid JSON document, and 0 if not.
In MariaDB, JSON_UNQUOTE() is a built-in function that removes quotes from a JSON value. In other words, it “unquotes” a JSON value.
In MariaDB, JSON_TYPE() is a built-in function that returns the type of a JSON value, as a string.
In MariaDB, JSON_SEARCH() is a built-in function that allows you to get the path to a given value in a JSON document.
It accepts the JSON document and a string as arguments, and returns the path to the given string within the document.
In MariaDB, JSON_REMOVE() is a built-in function that removes data from a JSON document and returns the result.
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.
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.