![](https://static.wixstatic.com/media/11062b_fac51a38acf24ea2aa030216e01a0ea3f000.jpg/v1/fill/w_288,h_162,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/11062b_fac51a38acf24ea2aa030216e01a0ea3f000.jpg)
Syntax:
JSON_QUOTE(string)
Quotes a string as a JSON value by wrapping it with double quote
characters and escaping interior quote and other characters, then
returning the result as a utf8mb4 string. Returns NULL if the argument
is NULL.
This function is typically used to produce a valid JSON string literal
for inclusion within a JSON document.
Certain special characters are escaped with backslashes per the escape
sequences shown in
https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.htm
l#json-unquote-character-escape-sequences.
URL: https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html
Example
mysql> SELECT JSON_QUOTE('null'), JSON_QUOTE('"null"');
+--------------------+----------------------+
| JSON_QUOTE('null') | JSON_QUOTE('"null"') |
+--------------------+----------------------+
| "null" | "\"null\"" |
+--------------------+----------------------+
mysql> SELECT JSON_QUOTE('[1, 2, 3]');
+-------------------------+
| JSON_QUOTE('[1, 2, 3]') |
+-------------------------+
| "[1, 2, 3]" |
+-------------------------+