首页 > 解决方案 > 在 Redshift 中解析为 json 类型?

问题描述

在 Postgres 中,我可以使用以下内容解析 json:

select
        *
    from
        (
            select
                json_array_elements(serialized_data :: json) -> 'fields' ->> 'rent_amount' as rent_amount,
                json_array_elements(serialized_data :: json) ->> 'model' as model,
                json_array_elements(serialized_data :: json) ->> 'pk' as listing_id,
                *
            from
                public.field_history_fieldhistory
            where
                field_name = 'rent_amount' -- limit 30
        ) x
    where
        model = 'listings.listing'
    order by
        listing_id,
        date_created

但是,我需要将此查询转移到 Redshift,现在我得到了错误type "json" does not exist

我将如何在 Redshift 中实现这一点?谢谢你。

标签: amazon-redshift

解决方案


推荐阅读