Purpose
JSON_UNQUOTE() unquotes a JSON value and returns the result in a utf8mb4 string.
Syntax
JSON_UNQUOTE(json_val)
Description
json_val specifies the quoted JSON value. If the argument is NULL, NULL is returned.
If the value starts and ends with double quotation marks ('') but is not a valid JSON string literal, an error occurs.
Examples
obclient> SET @jn = '"abcd"';
Query OK, 0 rows affected
obclient> SELECT @jn, JSON_UNQUOTE(@jn);
+--------+-------------------+
| @jn | JSON_UNQUOTE(@jn) |
+--------+-------------------+
| "abcd" | abcd |
+--------+-------------------+
1 row in set
obclient> SET @jn = '[1, 2, 3, 4]';
Query OK, 0 rows affected
obclient> SELECT @jn, JSON_UNQUOTE(@jn);
+--------------+-------------------+
| @jn | JSON_UNQUOTE(@jn) |
+--------------+-------------------+
| [1, 2, 3, 4] | [1, 2, 3, 4] |
+--------------+-------------------+
1 row in set