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 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

  1. mysql> SELECT json_unquote('"doris"');
  2. +-------------------------+
  3. | json_unquote('"doris"') |
  4. +-------------------------+
  5. | doris |
  6. +-------------------------+
  7. mysql> SELECT json_unquote('[1, 2, 3]');
  8. +---------------------------+
  9. | json_unquote('[1, 2, 3]') |
  10. +---------------------------+
  11. | [1, 2, 3] |
  12. +---------------------------+
  13. mysql> SELECT json_unquote(null);
  14. +--------------------+
  15. | json_unquote(NULL) |
  16. +--------------------+
  17. | NULL |
  18. +--------------------+
  19. mysql> SELECT json_unquote('"\\ttest"');
  20. +--------------------------+
  21. | json_unquote('"\ttest"') |
  22. +--------------------------+
  23. | test |
  24. +--------------------------+

keywords

json,unquote,json_unquote