json_quote

description

Syntax

VARCHAR json_quote(VARCHAR)

将json_value用双引号(”)括起来,跳过其中包含的特殊转义字符

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

keywords

json,quote,json_quote