Skip to content

Postgres: SELECT (list) a JSON-type row's keys separately

SELECT
    key AS column_name,
    value AS column_value
FROM
    table_name,
    jsonb_each(table_name.row_name) WHERE index = index_value_here;

WHERE index is used to limit the amount of data queried. without a limiter, the query will query the whole table, which is likely not the intended approach.