I'm receiving from an API a JavaScript array inside a string like the following:
'["qwe","asd","zxc","345"]'
And I'm trying to get it to become a list of items, which I did.
SELECT regexp_substr(
REPLACE(
REPLACE(
REPLACE('["qwe","asd","zxc","345"]', '"', ''),
'[',''),
']',''),
'[^,]+', 1, LEVEL) AS Lista
FROM dual
CONNECT BY instr(REPLACE(
REPLACE(
REPLACE('["qwe","asd","zxc","345"]', '"', ''),
'[',''),
']','')
, ',', 1, LEVEL - 1) > 0;
The problems is that it doesn't feel right.
Please, can someone help me to either optimize/improve the code or maybe confirm that this is it and there is nothing to be done.
Thx
json_table()