JSON_UNQUOTE
Description
This function unquotes a JSON value and returns the result as a utf8mb4 string.
Syntax
JSON_UNQUOTE(json_val)
Description
The json_val parameter is a quoted JSON value. If the parameter is NULL, the function returns NULL.
If the value starts and ends with double quotes but is not a valid JSON string literal, an error occurs.
Examples
SET @jn = '"abcd"';
Query OK, 0 rows affected (0.000 sec)
SELECT @jn, JSON_UNQUOTE(@jn);
+--------+-------------------+
| @jn | JSON_UNQUOTE(@jn) |
+--------+-------------------+
| "abcd" | abcd |
+--------+-------------------+
1 row in set (0.001 sec)
SET @jn = '[1, 2, 3, 4]';
Query OK, 0 rows affected (0.000 sec)
SELECT @jn, JSON_UNQUOTE(@jn);
+--------------+-------------------+
| @jn | JSON_UNQUOTE(@jn) |
+--------------+-------------------+
| [1, 2, 3, 4] | [1, 2, 3, 4] |
+--------------+-------------------+
1 row in set (0.001 sec)