I have a difficulty to query element in JSON column in MySQL
example of whats in the column :
{\order\":[{\"product_id\":3,\"quantity\":5,\"product_name\":\"Ikan salmon bakar \"}]}"
I'm using this sql syntax :
SELECT JSON_EXTRACT(order_list, '$.order[*].product_id') FROM orders_copy WHERE id = 3;
If I use this query to the column that contain backslash, then it will produce null.
Expected result (eg:) :
I'm not sure if I should get rid of the backslash so that the query will produce result or is there any effective way solving it ?.
Thanks a lot
I found the answers for problem I stated above.
It is just that I found the answer through this link : https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-replace , where I search for what are the code that are compatible with MySQL version to cater special character. For backslash, I'm using JSON_UNQUOTE()
Here I put the solution : https://www.db-fiddle.com/f/i7EpX4Qq86iJWFkPgzMhVX/0
Thanks to those who help:)