dolt
dolt copied to clipboard
Casting json to string doesn't escape double quotes in keys/values
MySQL:
mysql> select cast(JSON_OBJECT('key"with"quotes', 1) as char);
+--------------------------+
| cast(@a as char) |
+--------------------------+
| {"key\"with\"quotes": 1} |
+--------------------------+
1 row in set (0.00 sec)
mysql> select cast(cast(JSON_OBJECT('key"with"quotes', 1) as char) as json);
+---------------------------------------------------------------+
| cast(cast(JSON_OBJECT('key"with"quotes', 1) as char) as json) |
+---------------------------------------------------------------+
| {"key\"with\"quotes": 1} |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
Dolt:
> select cast(JSON_OBJECT('key"with"quotes', 1) as char);
+-------------------------------------------------+
| cast(JSON_OBJECT('key"with"quotes', 1) as char) |
+-------------------------------------------------+
| {"key"with"quotes": 1} |
+-------------------------------------------------+
1 row in set (0.00 sec)
> select cast(cast(JSON_OBJECT('key"with"quotes', 1) as char) as json);
expression 'convert(convert(json_object('key"with"quotes',1), char), json)': couldn't convert to json: Invalid JSON text: invalid character 'w' after object key