Skip to content
Advertisement

Getting JSON Array elements as records

I’m trying to extract elements from a simple JSON array in a PostgreSQL table like:

I would like to devise a SELECT statement to produce an output like:

Advertisement

Answer

Use jsonb_array_elements() to unnest the elements of the array:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement