JSONB_ARRAY_ELEMENTS
Expands a JSON array into rows — one row per element.
Syntax
JSONB_ARRAY_ELEMENTS(<json array>)
JSONB_ARRAY_ELEMENTS_TEXT(<json array>)
Like UNNEST, but for JSON: from one array it makes as many rows as the array has elements. Each element stays jsonb; if you need text, use JSONB_ARRAY_ELEMENTS_TEXT. Handy when the application stores a list in a JSON field and in SQL you need to work with it like a table.