Skip to main content
Skip to main content

json_unquote

json_unquote

Description

Syntax

VARCHAR json_ununquote(VARCHAR)

This function unquotes a JSON value and returns the result as a utf8mb4 string. If the argument is NULL, it will return NULL.

Escape sequences within a string as shown in the following table will be recognized. Backslashes will be ignored for all other escape sequences.

Escape SequenceCharacter Represented by Sequence
\"A double quote (") character
\bA backspace character
\fA formfeed character
\nA newline (linefeed) character
\rA carriage return character
\tA tab character
\A backslash () character
\uxxxxUTF-8 bytes for Unicode value XXXX

example

mysql> SELECT json_unquote('"doris"');
+-------------------------+
| json_unquote('"doris"') |
+-------------------------+
| doris |
+-------------------------+

mysql> SELECT json_unquote('[1, 2, 3]');
+---------------------------+
| json_unquote('[1, 2, 3]') |
+---------------------------+
| [1, 2, 3] |
+---------------------------+


mysql> SELECT json_unquote(null);
+--------------------+
| json_unquote(NULL) |
+--------------------+
| NULL |
+--------------------+

mysql> SELECT json_unquote('"\\ttest"');
+--------------------------+
| json_unquote('"\ttest"') |
+--------------------------+
| test |
+--------------------------+

keywords

json,unquote,json_unquote