The json_array_elements()
function in PostgreSQL allows you to extract elements from a JSON array property and return them as separate rows.
WITH test AS (
SELECT '{"array": [ "v1", "v2", "v3", "v4", "v5" ]}'::json AS json
)
SELECT j.* FROM test, json_array_elements(json -> 'array') j;
The above query will return each element of the JSON array as a separate row.
ยฉ 2025 juniyunapapa@gmail.com.