in column steps i have json values like [{"id":"ali","status":"open","reminder":"tomorrow","show_due_date":"true"}]
and i want to query new table like separate column for each key
id | status| reminder | show_due_date
i wrote this script but getting error of cannot call jsonb_to_recordset on a non-array
WITH series (jsonbrecords) AS (Select steps::jsonb from files)
INSERT INTO new
(column1,
column2,
column3,
column4)
SELECT t."id", t."status", t."reminder", t."show_due_date"
FROM series
CROSS JOIN LATERAL
jsonb_array_elements(jsonbrecords) AS x(doc),
jsonb_to_recordset(x.doc) as t("id" text, "status" text,"reminder" text,"show_due_date" text)