JSON_QUOTE
Descriptionβ
Enclose json_value in double quotes ("), escape special characters contained.
Syntaxβ
JSON_QUOTE (<a>)
Parametersβ
Parameter | Description |
---|---|
<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" |
+------------------------+