In a Redshift database, given a field containing the following json:
{"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true}
Although I can extract true
using json_extract_path_text(my_field, '0')
, when I'm trying to extract an element and cast it to a boolean as follow:
SELECT
json_extract_path_text(my_field, '0')::boolean
FROM my_table
I then get the following error:
cannot cast type text to boolean
I do not understand as the following is working without any issue:
SELECT 'true'::boolean, 'false'::boolean;