json_unquote

Description

Syntax

VARCHAR json_unquote(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 Sequence Character Represented by Sequence
\” A double quote (“) character
\b A backspace character
\f A formfeed character
\n A newline (linefeed) character
\r A carriage return character
\t A tab character
\ A backslash () character
\uxxxx UTF-8 bytes for Unicode value XXXX

example

1. mysql> SELECT json_unquote('"doris"');
2. +-------------------------+
3. | json_unquote('"doris"') |
4. +-------------------------+
5. | doris                   |
6. +-------------------------+

8. mysql> SELECT json_unquote('[1, 2, 3]');
9. +---------------------------+
10. | json_unquote('[1, 2, 3]') |
11. +---------------------------+
12. | [1, 2, 3]                 |
13. +---------------------------+

16. mysql> SELECT json_unquote(null);
17. +--------------------+
18. | json_unquote(NULL) |
19. +--------------------+
20. | NULL               |
21. +--------------------+

23. mysql> SELECT json_unquote('"\\ttest"');
24. +--------------------------+
25. | json_unquote('"\ttest"') |
26. +--------------------------+
27. |       test                    |
28. +--------------------------+

keywords

json,unquote,json_unquote