Unquote a JSON value. This function removes the quotes from a JSON string and unescapes special characters.
JSON_UNQUOTE(val)Unquotes a JSON value, returning a string, or NULL if the argument is null.
An error will occur if the given value begins and ends with double quotes and is an invalid JSON string literal.
If the given value is not a JSON string, value is passed through unmodified.
Certain character sequences have special meanings within a string. Usually, a backslash is ignored, but the escape sequences in the table below are recognised by MariaDB, unless the is set to NO_BACKSLASH_ESCAPES .
With the default :
Setting NO_BACKSLASH_ESCAPES:
This page is licensed: CC BY-SA / Gnu FDL
\
Backslash ()
\uXXXX
UTF-8 bytes for Unicode value XXXX
"
Double quote (")
\b
Backslash
\f
Formfeed
\n
Newline (linefeed)
\r
Carriage return
\t
Tab
SELECT JSON_UNQUOTE('"Monty"');
+-------------------------+
| JSON_UNQUOTE('"Monty"') |
+-------------------------+
| Monty |
+-------------------------+SELECT JSON_UNQUOTE('Si\bng\ting');
+-----------------------------+
| JSON_UNQUOTE('Si\bng\ting') |
+-----------------------------+
| Sng ing |
+-----------------------------+SET @@sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT JSON_UNQUOTE('Si\bng\ting');
+-----------------------------+
| JSON_UNQUOTE('Si\bng\ting') |
+-----------------------------+
| Si\bng\ting |
+-----------------------------+