Bug #117663 JSON_ARRAY func result error
Submitted: 11 Mar 8:29 Modified: 11 Mar 8:56
Reporter: ximin liang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:9.2.0 OS:Any
Assigned to: CPU Architecture:Any

[11 Mar 8:29] ximin liang
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)
[11 Mar 8:56] MySQL Verification Team
Hello ximin liang,

Thank you for the report and test case.

regards,
Umesh