I have table with a string column which contains data in JSON format. Then, I'm using the function get_json_object
to parse some data from it. The problem is that one of my fields contains a .
in its name. So, if write the field name in plain text, the function will interpret it like a child operator.
Here is a sample code that works:
select get_json_object(col, '$.rootkey')from (select '{"rootkey":15,"key.a":16,"key.b":17}' as col) test;
But this one fails:
select get_json_object(col, '$.key.a')from (select '{"rootkey":15,"key.a":16,"key.b":17}' as col) test;
Is there any way escape .
in the get_json_object
function?