Description:
Hello MySQL team:
Here is a bug about json_array func, detail can be seen as follow.
How to repeat:
Can be repeated in 9.2:
mysql> select JSON_ARRAY( '{\"1\":\"2\"}' );
+-------------------------------+
| JSON_ARRAY( '{\"1\":\"2\"}' ) |
+-------------------------------+
| ["{\"1\":\"2\"}"] |
+-------------------------------+
but in Oracle if exeute `select JSON_ARRAY( '{\"1\":\"2\"}' );`
result: ["{\\\"1\\\":\\\"2\\\"}"]
if try cast result as json in MySQL:
mysql> select cast('["{\"1\":\"2\"}"]' as json);
ERROR 3141 (22032): Invalid JSON text in argument 1 to function cast_as_json: "Missing a comma or ']' after an array element." at position 4.
mysql> select cast('["{\\\"1\\\":\\\"2\\\"}"]' as json);
+-------------------------------------------+
| cast('["{\\\"1\\\":\\\"2\\\"}"]' as json) |
+-------------------------------------------+
| ["{\"1\":\"2\"}"] |
+-------------------------------------------+
1 row in set (0.00 sec)
Description: Hello MySQL team: Here is a bug about json_array func, detail can be seen as follow. How to repeat: Can be repeated in 9.2: mysql> select JSON_ARRAY( '{\"1\":\"2\"}' ); +-------------------------------+ | JSON_ARRAY( '{\"1\":\"2\"}' ) | +-------------------------------+ | ["{\"1\":\"2\"}"] | +-------------------------------+ but in Oracle if exeute `select JSON_ARRAY( '{\"1\":\"2\"}' );` result: ["{\\\"1\\\":\\\"2\\\"}"] if try cast result as json in MySQL: mysql> select cast('["{\"1\":\"2\"}"]' as json); ERROR 3141 (22032): Invalid JSON text in argument 1 to function cast_as_json: "Missing a comma or ']' after an array element." at position 4. mysql> select cast('["{\\\"1\\\":\\\"2\\\"}"]' as json); +-------------------------------------------+ | cast('["{\\\"1\\\":\\\"2\\\"}"]' as json) | +-------------------------------------------+ | ["{\"1\":\"2\"}"] | +-------------------------------------------+ 1 row in set (0.00 sec)