Skip to main content

JSON_QUOTE

Description​

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

Syntax​

JSON_QUOTE (<a>)

Parameters​

ParameterDescription
<a>The value of the json_value to be enclosed.

Return Values​

Return a json_value. Special cases are as follows:

  • If the passed parameter is NULL, return NULL.

Examples​

SELECT json_quote('null'), json_quote('"null"');
+--------------------+----------------------+
| json_quote('null') | json_quote('"null"') |
+--------------------+----------------------+
| "null" | "\"null\"" |
+--------------------+----------------------+
SELECT json_quote('[1, 2, 3]');
+-------------------------+
| json_quote('[1, 2, 3]') |
+-------------------------+
| "[1, 2, 3]" |
+-------------------------+
SELECT json_quote(null);
+------------------+
| json_quote(null) |
+------------------+
| NULL |
+------------------+
select json_quote("\n\b\r\t");
+------------------------+
| json_quote('\n\b\r\t') |
+------------------------+
| "\n\b\r\t" |
+------------------------+