Bug? JSON functions do not work in nested JSON arrays
JSON_EXTRACT works for a non-arrayed JSON string but when working with an array I am unable to pull out array elements. Unless I'm doing this wrong?
select JSON_EXTRACT('{"KOJC":{"Tmp":"25"}}', '$.KOJC'); +-------------------------------------------------+
| JSON_EXTRACT('{"KOJC":{"Tmp":"25"}}', '$.KOJC') |
+-------------------------------------------------+
| {"Tmp": "25"} |
+-------------------------------------------------+
1 row in set (0.01 sec)
^ that work, but the below does not when presented with a array:
select JSON_EXTRACT('[{"KOJC":{"Tmp":"25"}}, {"KTWX":{"Tmp":"32"}}]', '$.KOJC');
+--------------------------------------------------------------------------+
| JSON_EXTRACT('[{"KOJC":{"Tmp":"25"}}, {"KTWX":{"Tmp":"32"}}]', '$.KOJC') |
+--------------------------------------------------------------------------+
| NULL |
+--------------------------------------------------------------------------+
1 row in set (0.00 sec)
select JSON_EXTRACT('[{"KOJC":{"Tmp":"25"}}, {"KTWX":{"Tmp":"32"}}]', '$[KOJC][*]');
ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 2.
select JSON_EXTRACT('[{"KOJC":{"Tmp":"25"}}, {"KTWX":{"Tmp":"32"}}]', '$[$.KOJC][*]');
ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 2.
Subject
Views
Written By
Posted
Bug? JSON functions do not work in nested JSON arrays
3073
January 15, 2017 01:00PM
768
January 15, 2017 01:06PM
903
January 16, 2017 02:13PM
727
January 17, 2017 08:06AM
852
January 18, 2017 08:28AM
723
January 18, 2017 10:09AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.