MySQL JSON_SEARCH and JSON_REPLACE don't escape quotes

Viewed 922

I have a JSON column in a MySQL DB. I'm trying to replace a JSON object with another using

UPDATE table SET ColName = JSON_REPLACE(ColName, '{"sample": "sample"}');

It seems after executing this statement, MySQL is inserting \" escaped quotes around my JSON properties like so:

{\"sample\": \"sample\"}

This is causing my JSON_SEARCH query to fail in finding "sample" due to the escaped quotes. Is there a way I can use JSON_REPLACE without having it add escapes to the double quotes?

I tried wrapping JSON_UNQUOTE around JSON_REPLACE in my update statement, this did don't resolve the issue.

1 Answers
Related