Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: JSON_OBJECT会自动去除转义符号

【TiDB Usage Environment】Production / Testing / PoC
【TiDB Version】
【Reproduction Path】What operations were performed when the issue occurred
【Encountered Issue: Issue Phenomenon and Impact】
【Resource Configuration】Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
【Attachments: Screenshots / Logs / Monitoring】
select JSON_OBJECT(“icon”,“”,“display”,“ab\c”,“regular_validation_rule”,“^-?[1-9]\d*$”);
This SQL statement automatically removes the underscore, resulting in {“display”: “abc”, “icon”: “”, “regular_validation_rule”: “^-?[1-9]d*$”}
If I use two backslashes, for example: select JSON_OBJECT(“icon”,“”,“display”,“ab\c”,“regular_validation_rule”,“^-?[1-9]\d*$”);
It becomes {“display”: “ab\c”, “icon”: “”, “regular_validation_rule”: “^-?[1-9]\d*$”}
Both of these are incorrect, causing an error in the regular expression. How should this be resolved?