json_quote

Description

Syntax

VARCHAR json_quote(VARCHAR)

Enclose json_value in double quotes (“), escape special characters contained.

example

  1. MySQL> SELECT json_quote('null'), json_quote('"null"');
  2. +--------------------+----------------------+
  3. | json_quote('null') | json_quote('"null"') |
  4. +--------------------+----------------------+
  5. | "null" | "\"null\"" |
  6. +--------------------+----------------------+
  7. MySQL> SELECT json_quote('[1, 2, 3]');
  8. +-------------------------+
  9. | json_quote('[1, 2, 3]') |
  10. +-------------------------+
  11. | "[1, 2, 3]" |
  12. +-------------------------+
  13. MySQL> SELECT json_quote(null);
  14. +------------------+
  15. | json_quote(null) |
  16. +------------------+
  17. | NULL |
  18. +------------------+
  19. MySQL> select json_quote("\n\b\r\t");
  20. +------------------------+
  21. | json_quote('\n\b\r\t') |
  22. +------------------------+
  23. | "\n\b\r\t" |
  24. +------------------------+

keyword

json_quote