json_array_elements_text? - Mailing list pgsql-general

From Laurence Rowe
Subject json_array_elements_text?
Date
Msg-id CAOycyLQcR=Fr6QzLpe_AL10oVPxkpA-jA1jniZ7JuAsZsSf30w@mail.gmail.com
Whole thread Raw
Responses Re: json_array_elements_text?
List pgsql-general
Hello,

I'm trying to unpack a json array into it's constituent text values so I can join them to a table. I can successfully unpack json values, but am having trouble converting these to text so I can cast them to the UUIDs needed for the join.


SELECT trim(json_array_elements(biosample.properties->'treatments')::text, '"')::uuid
FROM object biosample WHERE biosample.item_type = 'biosample'

But it seems kinda ugly. Am I missing something obvious or is postgres 9.3 just missing a json_array_elements_text function?


Laurence

pgsql-general by date:

Previous
From: Chris Travers
Date:
Subject: Re: PostgreSQL with ZFS on Linux
Next
From: Sameer Kumar
Date:
Subject: Re: Correct query to check streaming replication lag