Re: How to select values in a JSON type of column?

From: Snjezana Frketic <frketic(dot)snjezana(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to select values in a JSON type of column?
Date: 2020-11-18 14:48:27
Message-ID: CA+9_ahZTrFPiW7WZyriD1qGCn=x5NdHWqjZwCWqt1vLWhq462Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I looked at it yesterday, but I couldn't figure it out because my JSON is
more nested and I got lost going down the path.

On Wed, 18 Nov 2020 at 15:40, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

>
> On Wednesday, November 18, 2020, Snjezana Frketic <
> frketic(dot)snjezana(at)gmail(dot)com> wrote:
>
>>
>>
>> SELECT
>> targeting#>'{targets,0,audienceSegments,0,includes,0,segments,allOf,0,ids}'FROM
>> campaigns;
>>
>> and that works, but, I don’t want to have a fixed path because positions
>> could change like 0 could become 1, includes and excludes could change
>> positions, allOf could be anyOf etc.
>> Any idea of how to always select ids in includes no matter the changes?
>>
>
> Maybe it can be done using json path:
>
>
> https://www.postgresql.org/docs/13/functions-json.html#FUNCTIONS-SQLJSON-PATH
>
> David J.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2020-11-18 14:55:31 Re: How to select values in a JSON type of column?
Previous Message David G. Johnston 2020-11-18 14:40:43 Re: How to select values in a JSON type of column?