Comments - Extract values with escaped characters from JSON Document

1 year, 10 months ago Ian Gilfillan

You need to use two escape characters. A single escape would be applied by the SQL parser, but you want to pass the escaped string down. So:

Set @json = '{"Item_Name":"60\\" Table", "Item_ID":"1"}';

select json_value(@json,'$.Item_Name') as Item_Name , json_value(@json,'$.Item_ID') as ID;
+-----------+------+
| Item_Name | ID   |
+-----------+------+
| 60" Table | 1    |
+-----------+------+
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.