Purpose
This function unquotes a JSON value and returns the result as a utf8mb4 string.
Syntax
JSON_UNQUOTE(json_val)
Considerations
The json_val parameter specifies the quoted JSON value. If the parameter is NULL, NULL is returned.
If a value is enclosed in 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
